home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / eb33.zip / PACK1.ZIP / REFER.REP < prev    next >
Text File  |  1994-09-14  |  206KB  |  8,572 lines

  1.  
  2.  
  3.  
  4.        ════════════════════════════════════════════════════════════════
  5.                    EASY BASE PROGRAMMERS REFERENCE
  6.                                Contents
  7.        ────────────────────────────────────────────────────────────────
  8.  
  9.                    Procedure Commands            Page
  10.                    ──────────────────
  11.  
  12.                    Clear Records From             13
  13.                    Copy All From                  19
  14.                    Create Temp As                 21
  15.                    Declare                        34
  16.                    Delay                          37
  17.                    Delete Record                  39
  18.                    Derive Off                     40
  19.                    Display Status                 41
  20.                    Do..Loop                       42
  21.                    Escape On/Off                  44
  22.                    Exit Batch Menu                45
  23.                    Exit Procedure                 46
  24.                    For..Next                      49
  25.                    If Then Else                   63
  26.                    Index Off                      65
  27.                    List Variables                 76
  28.                    Multiple Lines                 90
  29.                    Odd/Even Page Print            91
  30.                    Pause On/Off                  101
  31.                    Preselect                     103
  32.                    Print                         104
  33.                    Printer Control               105
  34.                    Remark                        111
  35.                    Skip Group                    124
  36.                    Skip Record                   125
  37.                    Subindex                      131
  38.                    Update Record                 143
  39.  
  40.  
  41.                    System Values                 Page
  42.                    ─────────────
  43.  
  44.                    Blank.                          7
  45.                    Bottom Margin                   8
  46.                    Current Record                 23
  47.                    Global Number                  59
  48.                    Output                         98
  49.                    Page Number                   100
  50.                    Pi                            102
  51.                    Record Number                 110
  52.                    Sequence                      122
  53.                    System Date                   133
  54.                    System Time                   134
  55.                    Total Copies                  140
  56.                    Total Records                 141
  57. ................................................................................
  58.  
  59.  
  60.                    Functions                     Page
  61.                    ─────────
  62.  
  63.                    Abs                             1
  64.                    Chr$                           12
  65.                    Datetext                       30
  66.                    Dayofmonth                     31
  67.                    Dayofweek                      32
  68.                    Dayofyear                      33
  69.                    Default                        35
  70.                    Hours                          61
  71.                    If                             62
  72.                    Intext                         71
  73.                    Jointext                       72
  74.                    Lefttext                       73
  75.                    Lengthtext                     74
  76.                    Lookup                         77
  77.                    Lower                          78
  78.                    Makedate                       79
  79.                    Maketime                       80
  80.                    Maths                          81
  81.                    Midtext                        85
  82.                    Minutes                        86
  83.                    Mod                            87
  84.                    Month                          88
  85.                    Proper                        106
  86.                    Random                        108
  87.                    Retail                        113
  88.                    Reverse                       115
  89.                    Righttext                     116
  90.                    Round                         117
  91.                    Seconds                       121
  92.                    Spacepad                      126
  93.                    Spellday                      127
  94.                    Spellmonth                    128
  95.                    Stringof                      130
  96.                    Timeampm                      139
  97.                    Upper                         144
  98.                    V.A.T. Functions              145
  99.                    Year                          146
  100.                    Zeropad                       147
  101.  
  102.  
  103.                    Field Controls                Page
  104.                    ──────────────
  105.  
  106.                    Beep                            6
  107.                    Clearfields                    14
  108.                    Delay                          36
  109.                    Run                           118
  110. ................................................................................
  111.  
  112.  
  113.                    Field Types                   Page
  114.                    ───────────
  115.  
  116.                    Choice                         11
  117.                    Date                           29
  118.                    Fixed Point                    47
  119.                    Floating Point                 48
  120.                    Formatted Text                 57
  121.                    Integer                        70
  122.                    Text                          136
  123.                    Text Block                    137
  124.                    Time                          138
  125.  
  126.  
  127.                    Field Derivation Prefixes     Page
  128.                    ─────────────────────────
  129.  
  130.                    Current                        22
  131.                    Goto (Field) Next              60
  132.                    Retest                        114
  133.                    Start Here                    129
  134.  
  135.  
  136.                    Utilities                     Page
  137.                    ─────────
  138.  
  139.                    Alter Vat Rates                 4
  140.                    Backup Application              5
  141.                    Change Password                10
  142.                    Data Import                    26
  143.                    Delete Choice Lists            38
  144.                    Install Form                   67
  145.                    Install Printer                68
  146.                    Install Procedure              69
  147.                    List File Names                75
  148.                    Options                        97
  149.                    Pack Data Forms                99
  150.                    Rebuild Directories           109
  151.                    Restore                       112
  152.                    Screen Colours                120
  153.                    Set Paper Length              123
  154. ................................................................................
  155.  
  156.  
  157.                    User Menu Functions           Page
  158.                    ───────────────────
  159.  
  160.                    Menu Calls                     84
  161.  
  162.  
  163.                    Operators                     Page
  164.                    ─────────
  165.  
  166.                    Arithmetic                     94
  167.                    Logical                        96
  168.                    Relational                     95
  169.  
  170.  
  171.                    Methods                       Page
  172.                    ───────
  173.  
  174.                    Address Labels                  2
  175.                    Bypass Sign-on Sreen            9
  176.                    Compound Index                 15
  177.                    Compound Lookups               18
  178.                    Correcting Stats.              20
  179.                    Customize Help Line            24
  180.                    Cyclic Procedures              25
  181.                    Data Type Conversion           28
  182.                    Duplicate Prevention           43
  183.                    Form Letters                   55
  184.                    Global Defaults                58
  185.                    Input Screen Format            66
  186.                    Maximizing Speed               82
  187.                    Multiple Columns               89
  188.                    Q And A Input Screen          107
  189.                    Runtime Auto Start            119
  190.                    Tabulation                    135
  191.                    Totals & Sub Totals           142
  192. ................................................................................
  193.        ABS                        FUNCTION                         ABS
  194.  
  195.        This function returns the absolute (positive) value of a
  196.        number.
  197.  
  198.        Ex. abs(length - breadth)
  199.           This returns 6 if length = 12 and breadth = 6
  200.           or if length = 6 and breadth = 12
  201.  
  202.  
  203.        Acceptable parameters
  204.  
  205.        Numeric value
  206.        Numeric expression
  207.        Numeric field/variable
  208.        Any function which returns a numeric value
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.                                  - 1 -
  249. ................................................................................
  250.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  251.  
  252.        The following procedure prints two columns of address labels
  253.        from a "Addr" form.
  254.  
  255.        .......................Procedure code................
  256.  
  257.        Declare output fields
  258.           Addr.name : Addr.street : Addr.town : Addr.pcode
  259.           Lname : Lstreet : Ltown : Lpcode
  260.        end
  261.        for Addr
  262.           if Lname = blank then
  263.              Lname = Addr.name : Lstreet = Addrstreet
  264.              Ltown = Addr.town : Lpcode = Addrpcode
  265.           else
  266.              print list items
  267.              Lname = blank : Lstreet = blank
  268.              Ltown = Blank : Lpcode  = blank
  269.           end if
  270.        next
  271.        if Lname <> blank then print list items
  272.  
  273.        ....................Output Format........................
  274.  
  275.        .List Items
  276.  
  277.             {Lname field        }       {Addr.name field    }
  278.             {Lstreet field      }       {Addr.street field  }
  279.             {Ltown field        }       {Addr.town field    }
  280.             {Lpcode field       }       {Addr.pcode field   }
  281.  
  282.        .end
  283.  
  284.  
  285.        The field positioning and the distance between the .List Items
  286.        and .end can be adjusted to fit the label paper.
  287.  
  288.  
  289.        If your label paper has three columns then you could use the
  290.        following procedure.
  291.  
  292.        declare output fields
  293.           Addr.name : Addr.street : Addr.town : Addr.pcode
  294.           Mname : Mstreet : Mtown : Mpcode
  295.           Lname : Lstreet : Ltown : Lpcode
  296.        end
  297.        declare variables
  298.           x as number
  299.        end
  300.  
  301.        Continued.
  302.  
  303.  
  304.  
  305.                                  - 2 -
  306. ................................................................................
  307.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  308.  
  309.        for addr
  310.           x = x + 1
  311.           if Mod(x,3) = 1 then
  312.              Lname = Addr.name : Lstreet = Addr.street
  313.              Ltown = Addr.town : Lpcode = Addr.pcode
  314.           end if
  315.           if Mod(x,3) = 2 then
  316.              Mname = Addr.name : Mstreet = Addr.street
  317.              Mtown = Addr.town : Mpcode = Addr.pcode
  318.           end if
  319.           if Mod(x,3) = 0 then
  320.              Print list items
  321.              Lname = Blank : Lstreet = blank
  322.              Ltown = blank : Lpcode = Blank
  323.              Mname = Blank : Mstreet = blank
  324.              Mtown = blank : Mpcode = Blank
  325.           end if
  326.        next
  327.        If Lname <> blank then print list items
  328.  
  329.  
  330.        .........................output format...................
  331.  
  332.  
  333.        .list items
  334.  
  335.           { Lname       }    { Mname       }   { Addr.name   }
  336.           { Lstreet     }    { Mstreet     }   { Addr.street }
  337.           { Ltown       }    { Mtown       }   { Addr.town   }
  338.           { Lpcode      }    { Mpcode      }   { Addr.pcode  }
  339.  
  340.        .end
  341.  
  342.  
  343.  
  344.        See Also:- Form Letters
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.                                  - 3 -
  363. ................................................................................
  364.        ALTER VAT RATES            UTILITY              ALTER VAT RATES
  365.  
  366.        The five VAT rates used by the VAT functions can be altered
  367.        either from the utilities menu or from a user menu function.
  368.        Just select "Alter VAT rates" - edit the percentages and press
  369.        F2 to save the new values.
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.                                  - 4 -
  420. ................................................................................
  421.        BACKUP APPLICATION         UTILITY           BACKUP APPLICATION
  422.  
  423.        Easy Base includes an inbuilt Backup system for your
  424.        applications and data.
  425.  
  426.        If you select "Backup Application" from the utilities menu then
  427.        Easy Base will backup your entire application - Choicelist
  428.        fields - Forms - Data and procedures. The backup system will
  429.        split large files across multiple disks automatically.
  430.  
  431.        When an application is finished and you have backup copies then
  432.        backing up choice lists and procedures is wasteful of time and
  433.        floppies. You can backup only the users data by calling "Backup
  434.        Data" from a user menu.
  435.  
  436.        Backup Principles.
  437.  
  438.        The reason for a backup is that in the event of a computer or
  439.        hard disk failure you will have your application or data to
  440.        restore on the new machine.
  441.  
  442.  
  443.        If you have no backup and your machine fails then you have lost
  444.        all your data. If you have only one backup and your machine
  445.        fails while doing a backup then you have lost all your data.
  446.  
  447.        The principle of safe backing up is to keep two sets of backup
  448.        disks in separate boxes marked "Latest" and "Previous".
  449.        Whenever you do a backup you use the disks from the "Previous"
  450.        box - move the disks from the "Latest" to the "Previous" and
  451.        put your new backups in the latest box when completed.
  452.  
  453.        This not only overcomes the problem of a failure during backup
  454.        but also provides a secondary set of disks if any of the
  455.        "Latest" disks turn out to be faulty when you come to restore.
  456.  
  457.        If you ever have to use a backup disk and find that it has
  458.        developed a bad sector then you can attempt a recovery with a
  459.        utility such as "Norton" Disk Test. Easy Base leaves
  460.        approximately 5K of unused disk space on all backup disks so
  461.        that such a utility has somewhere to move bad sectors to.
  462.  
  463.        To save disk space, Easy Base does not backup index files. If
  464.        you ever have to use a backup disk then the index files are
  465.        rebuilt after restoring the data.
  466.  
  467.  
  468.        See Also:-  Restore
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.                                  - 5 -
  477. ................................................................................
  478.        BEEP                     FIELD CONTROL                     BEEP
  479.  
  480.        The "beep" control is used in field derivations to alert the
  481.        user to input errors. In addition to sounding the beeper the
  482.        "beep" control has two optional additional parts - A message to
  483.        be sent to the message line and cursor redirection. This is
  484.        normally to the field in which the error has been made but can
  485.        be to any field.  Field controls are appended to field
  486.        derivations and are enclosed in square brackets.
  487.  
  488.        Ex.  If(partno < 0,blank[beepPart Numbers must not be
  489.        negativeCursor partno],partno)
  490.  
  491.        In this example, if the user enters a negative number in the
  492.        partno field the computer will beep,the number will be cleared
  493.        from the field, the message "Part Numbers must not be negative"
  494.        will be displayed on the message line and the cursor will
  495.        return to the "partno" field.
  496.  
  497.        Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  498.        has been paid or cheque number entered in errorCursor
  499.        paid],paid)
  500.  
  501.        In Easy Base, division by zero is not trapped as an error.
  502.        There is a very good reason for this.  When you start a new
  503.        record and all the fields are blank then any field which
  504.        provides a value for a division in another field would cause a
  505.        division by zero error before its value had been entered.
  506.  
  507.        Whenever Easy Base encounters a division by Zero it divides by
  508.        one instead.  This is perfectly acceptable in most business
  509.        applications.  However, if you need to be warned of a division
  510.        by zero in formulae then you can provide your own error trap
  511.        using the "Beep" control.
  512.  
  513.        Ex.
  514.  
  515.           If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  516.                        T4)
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.                                  - 6 -
  534. ................................................................................
  535.        BLANK.                   SYSTEM VALUE                    BLANK.
  536.  
  537.        In Easy Base the value of any field which does not contain
  538.        characters is represented by the word "Blank" irrelevant of
  539.        data type.
  540.  
  541.        A numeric field returns the value "Blank" only when the field
  542.        is empty. If it has a value of zero then it is NOT blank.  In
  543.        fact, the main advantage of recognizing "Blank" is that you can
  544.        distinguish between zero value and empty numeric fields.
  545.  
  546.        There is, however, one slight disadvantage.  If a text field
  547.        contains ONLY the word blank and you use its value in a
  548.        derivation then the word "Blank" from the field will disappear.
  549.  
  550.        The "Name" field at the top left hand side of this page is
  551.        derived by the formula Upper(Name).  You will notice that
  552.        "Blank" is followed by a full stop.  If it were not then the
  553.        upper function would return "                    ".
  554.  
  555.        You can also remove a fields contents by setting it equal to
  556.        blank.
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.                                  - 7 -
  591. ................................................................................
  592.        BOTTOM MARGIN            SYSTEM VALUE             BOTTOM MARGIN
  593.  
  594.        Throughout a procedure which has a printed output, Easy base
  595.        keeps track of the length of page remaining (in inches) in the
  596.        system value "Bottom Margin". The Bottom margin value is used
  597.        to control pagination in procedures which "Report" on data.
  598.  
  599.        The "Bottom Margin" value is based on the paper type entered
  600.        from the Utilities Menu. You must set the type of paper you are
  601.        using before using "Bottom Margin".
  602.  
  603.        Ex.
  604.        Line feed: Line feed: Line feed
  605.        For employees
  606.           print list items
  607.           if bottom margin < .5 then
  608.              page feed: line feed :line feed : line feed
  609.           else
  610.              line feed
  611.           end if
  612.        next
  613.  
  614.        In the above example the list items section is printed with a
  615.        blank line between each and with a half inch top and bottom
  616.        page margin.
  617.  
  618.        When you base decisions on the "Bottom margin" value you should
  619.        always do so with a "Greater Than" or "Less Than" operator. If
  620.        you used " If Bottom margin = .5 then Page feed" your page
  621.        would only be ejected if and when the "Bottom Margin" value was
  622.        exactly 0.5  As most printing is done at six lines to the inch
  623.        it is most unlikely that the "Bottom margin" value would ever
  624.        be half an inch.
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.                                  - 8 -
  648. ................................................................................
  649.        BYPASS SIGN-ON SREEN        METHOD         BYPASS SIGN-ON SREEN
  650.  
  651.        You can bypass the sign-on screen for both the developers
  652.        password and any User-menu password by adding the password to
  653.        the start up command line. This is particularly useful in
  654.        finished applications as the application can be called directly
  655.        from a hard disk menu system - the sign on screen will not
  656.        appear and the application will start as if it were a stand
  657.        alone program.
  658.  
  659.        You can use either:-
  660.  
  661.           EB/password  or
  662.           EB password
  663.  
  664.        as your command line to bypass the sign on screen.
  665.  
  666.        See also "Runtime Autostart"
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.                                  - 9 -
  705. ................................................................................
  706.        CHANGE PASSWORD            UTILITY              CHANGE PASSWORD
  707.  
  708.        You can change your developers access password with this item
  709.        on the utilities menu.
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.                                  - 10 -
  762. ................................................................................
  763.        CHOICE                    FIELD TYPE                     CHOICE
  764.  
  765.        If you define a field as the "Choice" type a window will open
  766.        into which you can type up to seventeen different choices.
  767.        When you have entered your choices you will be asked to give a
  768.        name to your choice list. Once a choice list has been saved it
  769.        can be used in any other choice field in any other form or
  770.        input screen.
  771.  
  772.        Once a choice list has been saved you can edit the contents but
  773.        not the field length. Editing a choice list in one form
  774.        automatically edits it for any other form.
  775.  
  776.        If you need to alter a list such that the field length will
  777.        change then you must create a new list. You can erase the old
  778.        one from the utilities menu.  If the list is used in more than
  779.        one form then you must redefine it in all the other forms in
  780.        which it is used
  781.  
  782.        When the cursor enters a choice field your choice list will be
  783.        displayed for the user to choose from. He cannot enter any
  784.        value other than one from the list.
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.                                  - 11 -
  819. ................................................................................
  820.        CHR$                       FUNCTION                        CHR$
  821.  
  822.        The Chr$ function returns the character whose ASCII number is
  823.        supplied as the parameter.
  824.  
  825.        Ex.   Chr$(171)
  826.              < Returns "½">
  827.  
  828.        Ex.   Jointext(Chr$(227),"r",Chr$(253))
  829.              < Returns "πr²"
  830.  
  831.        In Easy Base, text fields are automatically justified left.
  832.        This is desirable in record entry as it prevents the user from
  833.        entering leading spaces in indexed fields and consequently
  834.        trashing alphabetic printouts. However, you may wish to right
  835.        justify or centre justify text in printouts. For example, the
  836.        righthand "Chr$" at the top of this page is right justified in
  837.        its field. You can use the ASCII character 255 to achieve right
  838.        or centre justification.
  839.  
  840.        Ex.
  841.  
  842.        Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  843.        name)
  844.            < This centres name in the 30 character field "heading">
  845.  
  846.        Ex.
  847.  
  848.        Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  849.  
  850.           < This right justifies name in a 40 character field
  851.             "Heading">
  852.  
  853.  
  854.        CAUTION:
  855.  
  856.        You can produce any ASCII character ( 0 - 255 ) with the Chr$
  857.        function. ASCII characters 0 to 31 are used as printer controls
  858.        and although you can use them freely on screen you should never
  859.        include them in a procedure output which will be sent to the
  860.        printer.
  861.  
  862.        Acceptable parameters:
  863.  
  864.        Numeric value, field, variable, expression or function
  865.        returning a number between 0 and 255
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.                                  - 12 -
  876. ................................................................................
  877.        CLEAR RECORDS FROM     PROCEDURE COMMAND     CLEAR RECORDS FROM
  878.  
  879.        The "Clear Records From" command clears all records from a form
  880.        by erasing its data and index files. If you need to erase all
  881.        records form a form always use the "Clear Records" command
  882.        rather than "Delete Record" command. It is much faster and does
  883.        not require the form to be re-packed afterward.
  884.  
  885.        Ex.
  886.  
  887.        If input.confirm = "yes" then clear records from invoices
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.                                  - 13 -
  933. ................................................................................
  934.        CLEARFIELDS              FIELD CONTROL              CLEARFIELDS
  935.  
  936.        The "Clearfields" control blanks out all other fields on a form
  937.        or procedure input screen whenever the field containing the
  938.        control is changed.
  939.  
  940.        The primary use for the "Clearfields" control is to force
  941.        default lookups to re-derive for procedures which edit data.
  942.  
  943.        For Example - If you wrote a procedure to alter customers
  944.        addresses and telephone numbers then you would have three
  945.        fields on the input screen.
  946.  
  947.        Accountno   derived   lookup(customers,accountno)
  948.  
  949.        address     derived   default(lookup(customers,address))
  950.  
  951.        Tel         derived   default(lookup(customers,tel))
  952.  
  953.        When you enter a customers account number, his old address and
  954.        telephone number will be looked up, but the "Default" function
  955.        will allow you to edit them. The procedure code would then
  956.        update the record with the new address and phone number.
  957.  
  958.        The problem is, that having entered an account number and
  959.        looked up the other fields, if you then realize you have
  960.        entered the wrong account number and change it, the other
  961.        fields will not re-derive because they now have a default
  962.        value.  To get them to lookup based on the new account number
  963.        you would have to take the cursor to each field and clear it
  964.        with the F6 key.
  965.  
  966.        you can automate this process by adding the "Clearfields"
  967.        control to the accountno derivation:-
  968.  
  969.        lookup(customers,accountno)[clearfields]
  970.  
  971.  
  972.        Note:  The "Clearfields" control will only work when appended
  973.        to a derivation which is already dependent on the value of the
  974.        field. If you want to clear fields based on a change to a field
  975.        which has no other derivation then you must derive the field
  976.        with its own name plus the "Clearfields" control.
  977.  
  978.        In a field "Number" the derivation - Number[clearfields] - will
  979.        clear all other fields when the "Number" field is edited but
  980.        the derivation [clearfields] will have no effect.
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.                                  - 14 -
  990. ................................................................................
  991.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  992.  
  993.        If you need to list records from a form in such a way that they
  994.        are grouped by one field but with each record in the group
  995.        ordered by another then you can either use a compound index
  996.        field or "Subindex" the group during the procedure.
  997.  
  998.        A compound index field is simply an additional field in which
  999.        the contents of two or more fields are compounded using the
  1000.        "Jointext" function. The field is indexed and the index on that
  1001.        field can then be used to select records with the desired group
  1002.        ordering.
  1003.  
  1004.        For example:- A "Videos" form has fields for "Title",
  1005.        "RentalPrice" and "Category".
  1006.  
  1007.        To list the records grouped by "Category" but with the "Titles"
  1008.        in each category in alphabetic order you add another field to
  1009.        the form which is Text, Indexed and long enough to hold the
  1010.        contents of both the "category" and "Title" fields. The field
  1011.        is derived by joining the text of the "Category" and "Title"
  1012.        fields.
  1013.  
  1014.        There are a couple of minor complications in creating compound
  1015.        index fields. Firstly the "Jointext" function by default strips
  1016.        any trailing space characters from the text it is joining. If a
  1017.        straight "Jointext" function was used and the first two videos
  1018.        entered were "A Bridge Too Far" and "Snow White" then the
  1019.        compound fields would derive as:-
  1020.  
  1021.        "WarA Bridge Too Far"  and
  1022.        "CartoonSnow White"
  1023.  
  1024.        When what you need is:-
  1025.  
  1026.        "War      A Bridge Too Far"  and
  1027.        "Cartoon  Snow White      "
  1028.  
  1029.        To produce the desired spacing in the compound field use the
  1030.        "Spacepad" function.
  1031.  
  1032.        If the length of the "Category" field is 15 then derive the
  1033.        compound field with - Jointext(spacepad(category,15),title)
  1034.  
  1035.        If you are compounding more than two fields then "spacepad" all
  1036.        the fields being joined to their own field's length except the
  1037.        last one.
  1038.  
  1039.        The maximum length of a text field in Easy Base is 80
  1040.        characters. If the fields you need to compound total more than
  1041.        80 then you must reduce the length of the field names. Compound
  1042.        indices in Text Block fields should not be used.
  1043.  
  1044.  
  1045.  
  1046.                                  - 15 -
  1047. ................................................................................
  1048.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1049.  
  1050.        Once you have created a compound field and checked that it
  1051.        derives correctly it is normal to define it as invisible and no
  1052.        entry anyway as it is not its contents that are of interest but
  1053.        the order which its index produces.
  1054.  
  1055.        Ex.   Assuming the compound field was called "catgroup"
  1056.  
  1057.        ..........................code..................
  1058.        for videos with catgroup in order
  1059.           print list items
  1060.        next
  1061.        ........................format.................
  1062.        .List Items
  1063.              {Videos.Category Field}     {Videos.Title Field}
  1064.        .End
  1065.  
  1066.  
  1067.        Ex.
  1068.  
  1069.  
  1070.        ...........................code....................
  1071.        declare variables
  1072.           catcheck as text
  1073.        end
  1074.        for videos with catgroup in order
  1075.           if catcheck <> videos,category then print group header
  1076.           catcheck = videos.category
  1077.           print list items
  1078.        next
  1079.        ..........................format...............
  1080.        .Group Header
  1081.           -------------------------------------
  1082.           Films categorized as {category field}
  1083.           -------------------------------------
  1084.        .List Items
  1085.                      {Title field}
  1086.        .End
  1087.  
  1088.        There is yet a further complication if one or more of the
  1089.        fields to be compounded is numeric. Easy Base index files are
  1090.        sorted alphabetically if the field is text and numerically if
  1091.        the field is numeric. A compound field is always text so if you
  1092.        need to compound a numeric field you have to ensure that it
  1093.        will sort alphabetically to the same order that it sorts
  1094.        numerically. The text of numeric values sort alphabetically to
  1095.        the same order as their values only if they all have the same
  1096.        number of digits either side of the decimal point.
  1097.  
  1098.        6  12 and 34 sort alphabetically as 12  34  6
  1099.        but
  1100.        06 12 and 34 sort alphabetically as 06  12  34
  1101.  
  1102.  
  1103.                                  - 16 -
  1104. ................................................................................
  1105.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1106.  
  1107.        Easy Base provides the function "Zeropad" to pad numbers to the
  1108.        same length for compounding.  The "Zeropad" function has three
  1109.        parameters - The number to be padded, the number of digits left
  1110.        of the decimal to pad to and the number of digits right of the
  1111.        decimal to pad to. All three parameters must be supplied. If
  1112.        the number is an integer then the third parameter is 0.
  1113.  
  1114.        Ex. To list the "Videos" records grouped by rental price with
  1115.        the titles in each price group in order you would create a
  1116.        compound field derived with:-
  1117.  
  1118.        Jointext(zeropad(rentalprice,2,2),title)
  1119.  
  1120.        Ex.
  1121.  
  1122.        A "Ships" form has fields for "Type" and "Displacement"
  1123.  
  1124.        To list the ships grouped by type with the Displacement in each
  1125.        group in order you would create a compound field derived with:-
  1126.  
  1127.        jointext(spacepad(type,15),zeropad(displacement,8,0))
  1128.  
  1129.        In many cases where you wish to compound a mixture of text and
  1130.        numeric fields you will require the numeric values to be listed
  1131.        in descending order while the text value is to be in alphabetic
  1132.        order.
  1133.  
  1134.        In the above example for ships, had you wished each group to
  1135.        be listed with "Displacement" in descending order you would
  1136.        derive the compound field as:-
  1137.  
  1138.        jointext(spacepad(type,15),reverse(zeropad(displacement,8,0)))
  1139.  
  1140.        The "Reverse" function simply inverts the ACSII number of each
  1141.        character in its parameter so that it will sort in reverse
  1142.        order in the index file.
  1143.  
  1144.        The "Reverse" function works equally well on text values
  1145.        although reverse alphabetic lists are seldom required.
  1146.  
  1147.        The "Zeropad" function will only pad out a number to the size
  1148.        required. It will not trim the number if it is already longer
  1149.        than one of the pad lengths. You should not therefore create
  1150.        compound fields with Floating Point numbers.
  1151.  
  1152.        If you compound a date or time field you should zeropad it to
  1153.        5,0 as the text which will be used is actually the date or time
  1154.        fields numeric value.
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.                                  - 17 -
  1161. ................................................................................
  1162.        COMPOUND LOOKUPS            METHOD             COMPOUND LOOKUPS
  1163.  
  1164.        Occasionally, in an input screen, you will wish to lookup
  1165.        details from a form whose unique field is a compound of two
  1166.        others.  As an example, if you wished to lookup details from
  1167.        the "Userlist" form, mentioned in the manual, then you would
  1168.        have to base the lookups on a relationship between a field on
  1169.        the input screen and the "UNI" field in "Userlist". The "UNI"
  1170.        field in userlist is a combination of the "Aircraft" forms
  1171.        "Knownas" field and the "Airlines" form "Name" field.
  1172.  
  1173.        Although you could simply use a field "UNI" on the input screen
  1174.        and derive it :- Lookup(userlist,uni) - this would mean that
  1175.        the end user would have to enter the whole of the aircraft
  1176.        Knownas part plus part of the airlines name part plus the "*"
  1177.        in order to get the lookup.
  1178.  
  1179.        This would not only be awkward to use but would also entail
  1180.        explaining compound fields to the end user.
  1181.  
  1182.        You can avoid this situation by providing two fields, one in
  1183.        which the user looks up the aircraft knownas field and one in
  1184.        which he looks up the airline name. These are based on separate
  1185.        relationships between the input screen and the "Aircraft" and
  1186.        "Airlines" forms.
  1187.  
  1188.        The input screen's "UNI" field can now be made invisible with
  1189.        no user entry and derived:- Jointext(knownas,name).
  1190.  
  1191.        A relationship is entered between the input screen and the
  1192.        "Userlist" form linking the "UNI" fields and all the required
  1193.        details can then be derived :- lookup(userlist,whatever).
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.                                  - 18 -
  1218. ................................................................................
  1219.        COPY ALL FROM          PROCEDURE COMMAND          COPY ALL FROM
  1220.  
  1221.        When you are transferring values from the fields of one form to
  1222.        the fields of another in preparation for a "New Record" or
  1223.        "Update Record"  you can use "Copy All From" to save time.
  1224.  
  1225.        Ex.
  1226.  
  1227.        for invoiceitems new record
  1228.           invoiceitems.item = input.item
  1229.           invoiceitems.price = input.price
  1230.           invoiceitems.quantity = input.quantity
  1231.           invoiceitems.vatrate = input.vatrate
  1232.        next
  1233.  
  1234.        can be replaced with:-
  1235.  
  1236.        for invoiceitems new record
  1237.           copy all from input
  1238.        next
  1239.  
  1240.        The data transfer in a "Copy All From" is based on the source
  1241.        and destination fields having the same name.
  1242.  
  1243.        If the source and destination fields have different data types
  1244.        Easy Base will attempt a conversion.
  1245.  
  1246.        The conversion will succeed between different numeric types and
  1247.        from numeric to text. It will fail from text to numeric and
  1248.        between any mismatch of date and time.
  1249.  
  1250.  
  1251.  
  1252.  
  1253.        See also:-  Derive Off, Duplicate Prevention
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.                                  - 19 -
  1275. ................................................................................
  1276.        CORRECTING STATS.           METHOD            CORRECTING STATS.
  1277.  
  1278.        If you write an application in which records are entered via
  1279.        procedures and "running" statistics are kept, you will have to
  1280.        provide procedures which allow the user to correct any mistakes
  1281.        he has made.
  1282.  
  1283.        For Example: - In a "Time Sheets" application the user enters a
  1284.        time and customer on the input screen of a procedure. The
  1285.        procedure then calculates the charge, writes the charge and
  1286.        customers name to the "Timesheet" form, adds the charge to the
  1287.        "Balance" field in the "Customers" form and also adds it to the
  1288.        "Total" field in the "Workinhand" form.
  1289.  
  1290.        If the operator makes an error then correcting the entry in the
  1291.        "Timesheet" form is simply a case of updating it but to correct
  1292.        the "Balance" and "Total" fields you must add the corrected
  1293.        value and subtract the old incorrect value.
  1294.  
  1295.        To get the two values together for your procedure, create an
  1296.        input screen where the operator enters the "line" ("line" is
  1297.        the unique sequenced field in "Timesheet").  Then create two
  1298.        fields for the values. The first, "oldval" is derived
  1299.        lookup(timesheet,charge) and the second, "newval" is derived
  1300.        default(lookup(timesheet,charge).
  1301.  
  1302.        The "Oldval" field can be invisible and has no user entry.
  1303.  
  1304.        You would also add two similarly derived fields "Oldcustomer"
  1305.        and "Newcustomer".
  1306.  
  1307.        When the user edits the "Newval" and/or "Newcustomer" field and
  1308.        presses F2 , all the required values are available to the
  1309.        procedure code:-
  1310.  
  1311.        pause off : escape off
  1312.        for timesheet with line = input.line
  1313.           timesheet.charge = input.newval
  1314.           timesheet.customer = input.newcustomer
  1315.           update record
  1316.        next
  1317.        for customers with name = input.oldcustomer
  1318.           customers.balance = customers.balance - input.oldval
  1319.           update record
  1320.        next
  1321.        for customers with name = input.newcustomer
  1322.           customers.balance = customers.balance + input.newval
  1323.           update record
  1324.        next
  1325.        for workinhand
  1326.          workinhand.total = workinhand.total+input.newval-input.oldval
  1327.          update record
  1328.        next
  1329.  
  1330.  
  1331.                                  - 20 -
  1332. ................................................................................
  1333.        CREATE TEMP AS         PROCEDURE COMMAND         CREATE TEMP AS
  1334.  
  1335.        The "Create Temp As" command makes a temporary form during a
  1336.        procedure. There are two main uses for the temporary form.
  1337.  
  1338.        1.  To physically sort the records in a form.
  1339.  
  1340.        Ex.
  1341.  
  1342.        create temp as addresses
  1343.        index off:pause off:escape off:derive off
  1344.        for addresses with surname in order
  1345.           for temp new record
  1346.              copy all from addresses
  1347.           next
  1348.        next
  1349.        rename temp as addresses
  1350.  
  1351.        The other main use for the temporary file is to save time when
  1352.        the majority of records in a form are to be deleted.
  1353.  
  1354.        Ex.
  1355.        A purchases ledger form is to be cleared down at the year end
  1356.        but any unreconciled payment entries are to be retained and
  1357.        flagged as last years. If there were 15000 records in the form
  1358.        of which only 50 were unreconciled then the procedure
  1359.  
  1360.        for purchases
  1361.           if purchases.reconciled = "yes" then
  1362.              delete record
  1363.           else
  1364.              purchases.lastyear = "yes"
  1365.              update record
  1366.           end if
  1367.        next
  1368.  
  1369.        would not only take a very long time to run but would leave the
  1370.        form full of deleted records and it would have to be re-packed.
  1371.  
  1372.        The same result can be achieved very quickly and without the
  1373.        need to re-pack with the following procedure.
  1374.  
  1375.        create temp as purchases
  1376.        for purchases with reconciled = "no"
  1377.           for temp new record
  1378.              copy all from purchases
  1379.              temp.lastyear = "yes"
  1380.           next
  1381.        next
  1382.        rename temp as purchases
  1383.  
  1384.        Do not use the "Clear Records" command to wipe the old file
  1385.        before using "Rename Temp As".  If you suffered a power failure
  1386.        after clearing and before renaming you would lose your data.
  1387.  
  1388.                                  - 21 -
  1389. ................................................................................
  1390.        CURRENT                DERIVATION PREFIX                CURRENT
  1391.  
  1392.        In Easy Base, fields are not normally derived when a previously
  1393.        entered record is viewed on screen. You can force a field to be
  1394.        rederived when viewed by prefixing the derivation with
  1395.        "current".
  1396.  
  1397.        Ex.  An invoice form has three fields Ivdate,Cdate and age.
  1398.  
  1399.        Ivdate is derived as   "system date"
  1400.        Cdate is derived as    "current system date"
  1401.        age is derived as      jointext(Cdate-Ivdate," Days old")
  1402.  
  1403.        Each time a record is viewed the Cdate field is rederived with
  1404.        the current system date and the age field shows the number of
  1405.        days since the record was filed.
  1406.  
  1407.        Ex.
  1408.  
  1409.        A form is used to price a certain job. It consists of fields
  1410.        for materials and their prices which are looked up from a
  1411.        "stock" form. If the primary lookup fields are prefixed with
  1412.        "current"   -  "current lookup(stock,item)"
  1413.  
  1414.        then each time a record is viewed it will reprice the job using
  1415.        the latest prices from the "stock" file.
  1416.  
  1417.        Please note that in the case of lookups, prefixing a secondary
  1418.        lookup has no effect. In the above example
  1419.  
  1420.          "current lookup(stock,price)"  would not work
  1421.  
  1422.        Provided that the primary lookup field is prefixed with
  1423.        "current" then any secondary lookups will also be rederived.
  1424.  
  1425.  
  1426.        The values of "Current" fields are also rederived whenever they
  1427.        are accessed in procedure code but they are NOT REDERIVED when
  1428.        they are accessed by a Lookup function.
  1429.  
  1430.  
  1431.        Note: You can only have one prefix on any one field derivation.
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.                                  - 22 -
  1446. ................................................................................
  1447.        CURRENT RECORD           SYSTEM VALUE            CURRENT RECORD
  1448.  
  1449.        Whenever a procedure is processing a "FOR" loop the number of
  1450.        the record being processed is available in the "Current Record"
  1451.        system value. The "Current Record" value is the records actual
  1452.        number in the form, not the number of records processed.
  1453.  
  1454.        Ex.
  1455.  
  1456.        for books with category = "fiction"
  1457.           count = count + 1
  1458.           Posn = current record
  1459.        next
  1460.  
  1461.        If the first book found with the category "fiction" is the
  1462.        fifteenth record in the file then count will return 1 and
  1463.        Posn will return 15.
  1464.  
  1465.  
  1466.        The "Current Record" value has no meaning in field derivations.
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.                                  - 23 -
  1503. ................................................................................
  1504.        CUSTOMIZE HELP LINE         METHOD          CUSTOMIZE HELP LINE
  1505.  
  1506.        You can replace the default help line (bottom line) in both
  1507.        data entry and procedure input screens.
  1508.  
  1509.        Press F6 in form or input screen design to access the help
  1510.        line.
  1511.  
  1512.        If you wish to revert to the default help line just erase your
  1513.        customized one.
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.                                  - 24 -
  1560. ................................................................................
  1561.        CYCLIC PROCEDURES           METHOD            CYCLIC PROCEDURES
  1562.  
  1563.        In many applications you will come across the situation where
  1564.        you need a procedure which will perform the same actions on a
  1565.        given set of records. For example, in a payroll system the
  1566.        procedure which calculates the employees wage and deductions
  1567.        has to be repeated for each employee so that their hours can be
  1568.        entered. If you simply enter each employees Worksno and lookup
  1569.        his or her details then it will be easy to miss an employee or
  1570.        to do one twice.
  1571.  
  1572.        To avoid this you can create a procedure which will cycle each
  1573.        employee through the input screen and terminate when all
  1574.        employees have been processed.
  1575.  
  1576.        On the employees form, add a field "Cycled" which is a single
  1577.        character indexed field derived :- Default("N").
  1578.  
  1579.        On the procedure input screen add an invisible field "Cycled"
  1580.        which is derived "N"
  1581.  
  1582.        You now enter two relationships between the procedure and the
  1583.        employees form. The main relationship "Employees" links the
  1584.        fields "Worksno" and the second, lets call it "Cycled" links
  1585.        the "Cycled" fields.
  1586.  
  1587.        On the input screen you derive the "Worksno" field as
  1588.        Lookup(cycled,worksno) and all the other details as
  1589.        lookup(employees,Whatever).
  1590.  
  1591.        When you run the procedure, the first employees details will be
  1592.        loaded automatically and all you have to enter are his hours.
  1593.  
  1594.        To have the next employee loaded after you run the procedure,
  1595.        the procedure code simply includes the lines:-
  1596.  
  1597.        for employees with worksno = input.worksno
  1598.           employees.cycled = "Y"
  1599.           update record
  1600.        next
  1601.  
  1602.        When all employees have been processed the "Worksno" field will
  1603.        derive blank as there are no employees with "N" in the "Cycled"
  1604.        field. You can therefore pass a "finished" message by altering
  1605.        the derivation of "Worksno" to :-
  1606.  
  1607.          if(lookup(cycled,worksno)=blank,blank[beepAll Employees have
  1608.          now been processed],lookup(cycled,worksno))
  1609.  
  1610.        To reset cycling for the next payroll you write an additional
  1611.        procedure with the code:-
  1612.        for employees
  1613.           employees.cycled = "N" : update record
  1614.        next
  1615.  
  1616.                                  - 25 -
  1617. ................................................................................
  1618.        Data Import                UTILITY                  Data Import
  1619.  
  1620.        There are three Data Import routines in Easy Base. The first
  1621.        imports data from files which conform to the Xbase standard
  1622.        first introduced by Dbase. The second imports data from "Comma
  1623.        Delimited" files. This is the standard used by most sequencial
  1624.        access and non relational data systems. The third routine
  1625.        imports data from fixed length record text files. Although few
  1626.        systems actually store data as fixed length text, this is the
  1627.        format which is used by all systems to output data. You can
  1628.        therefore import data from virtually any other system by first
  1629.        reporting on it to a disk file and then importing it with the
  1630.        fixed length ASCII import routine.
  1631.  
  1632.        XBASE
  1633.  
  1634.        If the data you wish to import is in Xbase format, Easy Base
  1635.        will report the structure of the file. You can print this out
  1636.        by pressing F10. You now design a form to hold the imported
  1637.        data. The names that you give to the Easy Base fields do not
  1638.        have to be the same as the Xbase field names but they must be
  1639.        in the same order. If the Xbase fields are text then the Easy
  1640.        Base fields must be the same length. If the Xbase fields are
  1641.        numeric then the Easy Base fields must be numeric. It does not
  1642.        matter if they are different lengths and any of the three
  1643.        types, integer, fixed point or floating point can be used.
  1644.        If an Xbase field is a date field then it must be imported to
  1645.        an eight character text field in Easy Base. You can reformat it
  1646.        to an Easy Base date field after importation (See the Method -
  1647.        Data Type Conversion).  Easy Base does not support "Memo" data.
  1648.        If the Xbase file has a memo field you can still import from it
  1649.        but the memo field itself will be skipped by the import
  1650.        routine.
  1651.  
  1652.        COMMA DELIMITED
  1653.  
  1654.        To import data from comma delimited files all you have to do is
  1655.        design a form with the same number of fields as there are in
  1656.        the file to be imported. Numeric fields can be any of the three
  1657.        types and text fields should be long enough to hold the longest
  1658.        data expected in the incoming field. If any of the fields to be
  1659.        imported holds a date then it must be imported to a text field.
  1660.        You can convert it to a date later.
  1661.  
  1662.        FIXED LENGTH ASCII
  1663.  
  1664.        To import data from fixed length ASCII files you must design a
  1665.        form in which all fields are text and are exactly the same
  1666.        length and in the same order as the fields in the file to be
  1667.        imported. If the file to be imported has a header you can allow
  1668.        for this by entering the header length in bytes.
  1669.  
  1670.        If you are using the fixed length import routine to import data
  1671.        which you have output as a report from another system then
  1672.  
  1673.                                  - 26 -
  1674. ................................................................................
  1675.        Data Import                UTILITY                  Data Import
  1676.  
  1677.        please note the following points.
  1678.  
  1679.        The output report from the original system should have no
  1680.        headers, footers or left margin and there should be no spaces
  1681.        between fields.
  1682.  
  1683.        When the original system outputs the data it will add a
  1684.        carriage return and line feed sequence to the end of each
  1685.        record. When you design the form to import this data to, you
  1686.        must have a final two character text field to trap this
  1687.        sequence and maintain the same record length.  This field can
  1688.        be deleted after importation.
  1689.  
  1690.        All fields are imported as text. If any of them contain numeric
  1691.        values which you wish to convert to numeric fields you must do
  1692.        this after importation. (See Method Data Type Conversion)
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.                                  - 27 -
  1731. ................................................................................
  1732.        Data Type Conversion        METHOD         Data Type Conversion
  1733.  
  1734.        In Easy Base, modifying the structure of a data file after it
  1735.        contains data is very easy and flexible. If you select Modify
  1736.        Existing Form from the Forms menu you can add fields, delete
  1737.        fields, change field order, change field lengths and Easy Base
  1738.        will reformat your existing data automatically.
  1739.  
  1740.        You can NOT however change data types simply by changing the
  1741.        field type. If you change a field type and save the form you
  1742.        will almost certainly lose the data that was in that field.
  1743.        (Other than changing from one numeric type to another)
  1744.  
  1745.        If you work entirely within Easy Base there is no reason why
  1746.        you should ever need to change a field type. However, if you
  1747.        have imported data from Dbase or Fixed Length ASCII you may
  1748.        find yourself with numeric or date values held in text fields.
  1749.  
  1750.        The procedure for converting data from one type to another is
  1751.        as follows:-
  1752.  
  1753.        1.   Select Modify Existing Form
  1754.  
  1755.        2.   Add a new field of the desired type with a derivation
  1756.             formula such that it will derive its value from the field
  1757.             of the old type.
  1758.  
  1759.        3.   Save the form.
  1760.  
  1761.        4.   Select Modify the form again.
  1762.  
  1763.        5.   Cancel the derivation formula in the new field and delete
  1764.             the old field.
  1765.  
  1766.        6.   Re save the form.
  1767.  
  1768.  
  1769.        To derive a numeric field from a text field the derivation
  1770.        formula is simply the text field name.
  1771.  
  1772.        To derive a date field from a Dbase imported date in a text
  1773.        field called DT the formula is:-
  1774.  
  1775.        Makedate(midtext(DT,5,2),midtext(DT,7,2),midtext(DT,3,2))
  1776.  
  1777.        Version 3.10
  1778.  
  1779.        From V3.1 you can change field types between text and numeric
  1780.        and retain any numeric values that were in the field
  1781.        automatically . You still cannot change a field type from date
  1782.        or time to text or vice versa without following the above
  1783.        procedure.
  1784.  
  1785.  
  1786.  
  1787.                                  - 28 -
  1788. ................................................................................
  1789.        DATE                      FIELD TYPE                       DATE
  1790.  
  1791.        Date fields hold dates in the eight character format 11/11/94
  1792.  
  1793.        The assumed century runs from the first of January 1981 to the
  1794.        31st of december 2080.
  1795.  
  1796.        You can select whether you wish your dates to be displayed as
  1797.        day/month/year (European) or month/day/year (North American)
  1798.        from the "options" item on the utilities menu.
  1799.  
  1800.        You can perform addition and subtraction operations on date
  1801.        values in days.
  1802.  
  1803.        Ex.  System date + 30
  1804.  
  1805.        Arithmetic operations are only correct for the assumed century.
  1806.  
  1807.        Date fields are automatically checked for validity by the
  1808.        system.
  1809.  
  1810.        Easy base does not provide a ready made ten character date
  1811.        field but you can define one with the "Formatted Text" field
  1812.        type.
  1813.  
  1814.  
  1815.        See Also:-   Makedate
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                                  - 29 -
  1845. ................................................................................
  1846.        DATETEXT                   FUNCTION                    DATETEXT
  1847.  
  1848.        This function returns the date parameter in the form:-
  1849.  
  1850.        14th October 1994  or
  1851.        October 14th 1994  depending on the date format selected in
  1852.                           the utilities menu.
  1853.  
  1854.  
  1855.        Ex.    datetext(system date)
  1856.  
  1857.        Ex.    datetext(invoicedate + 30)
  1858.  
  1859.        Acceptable parameters:
  1860.  
  1861.        System date
  1862.        Date field
  1863.        Makedate function
  1864.        Date expression
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.                                  - 30 -
  1902. ................................................................................
  1903.        DAYOFMONTH                 FUNCTION                  DAYOFMONTH
  1904.  
  1905.        This function returns the day no.(1-31) of the date parameter.
  1906.  
  1907.        Ex. dayofmonth(system date)
  1908.  
  1909.        Ex  dayofmonth(registered)
  1910.  
  1911.        Ex.
  1912.  
  1913.        if dayofmonth(system date) = 28 then
  1914.           for statements with settled = "No"
  1915.              statements.overdue = "Yes"
  1916.              update record
  1917.           next
  1918.        end if
  1919.  
  1920.        Acceptable parameters:
  1921.  
  1922.        System date
  1923.        Date field
  1924.        Makedate function
  1925.        Date expression
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.                                  - 31 -
  1959. ................................................................................
  1960.        DAYOFWEEK                  FUNCTION                   DAYOFWEEK
  1961.  
  1962.        This function returns the day no.(1-7) of the date parameter.
  1963.  
  1964.        Ex.  dayofweek(system date)
  1965.  
  1966.        Ex.  day = spellday(dayofweek(diary.date))
  1967.  
  1968.        Ex.  The following procedure, if called from a batch execute
  1969.        menu will only run on a Monday.
  1970.  
  1971.        declare output fields
  1972.           takings.date
  1973.           takings.dailytotal
  1974.        end
  1975.        if dayofweek(system date) = 1 then
  1976.           for takings with date in reverse order
  1977.              print list items
  1978.              if system date - takings.date > 7 then exit for
  1979.           next
  1980.        end if
  1981.  
  1982.        Acceptable parameters:
  1983.  
  1984.        System date
  1985.        Date field
  1986.        Makedate function
  1987.        Date expression
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.                                  - 32 -
  2016. ................................................................................
  2017.        DAYOFYEAR                  FUNCTION                   DAYOFYEAR
  2018.  
  2019.        This function returns the day no.(1-365) of the date parameter.
  2020.  
  2021.        Ex.   dayofyear(system date)
  2022.  
  2023.        Ex.   days = dayofyear(events.date)
  2024.  
  2025.        Acceptable parameters:
  2026.  
  2027.        System date
  2028.        Date field
  2029.        Makedate function
  2030.        Date expression
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.                                  - 33 -
  2073. ................................................................................
  2074.        DECLARE                PROCEDURE COMMAND                DECLARE
  2075.  
  2076.        If you write a procedure which outputs information to the
  2077.        screen, printer or a disk file you must start it by declaring
  2078.        the output fields.
  2079.  
  2080.        Ex.
  2081.        Declare output fields
  2082.           Input.name
  2083.           Customers.name:customers.address:customers.acno
  2084.           countofinvoices
  2085.        end
  2086.  
  2087.        If fields you intend to print exist in a form then declare them
  2088.        as Formname.Fieldname.  Fields from the procedures Input Screen
  2089.        are declared as Input.fieldname. Easy Base will then use the
  2090.        field definitions from the form as defaults when you create the
  2091.        Output Format for the procedure.
  2092.  
  2093.        If a field which you intend to print is to be derived during
  2094.        the procedure and does not exist in a form as "countofinvoices"
  2095.        you can give it any name you wish up to forty characters but
  2096.        the name must not contain a ".". Once you have declared fields
  2097.        you can create the Output Format.
  2098.  
  2099.        If you declare an "Ad Hoc" field such as "countovinvoices" then
  2100.        you must include it in the format in order to define its type
  2101.        and length.
  2102.  
  2103.        If you require variables to store values during a procedure but
  2104.        you will not be out-putting their values then declare them as
  2105.        variables not fields.
  2106.  
  2107.        Ex.
  2108.  
  2109.        declare variables
  2110.           count as number
  2111.           lasttype as text
  2112.        end
  2113.  
  2114.        Unprinted variables can only have one of the two types "Number"
  2115.        or "Text".
  2116.  
  2117.        Field declarations must precede Variable declarations and both
  2118.        must precede executable code.
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.                                  - 34 -
  2130. ................................................................................
  2131.        DEFAULT                    FUNCTION                     DEFAULT
  2132.  
  2133.        This function returns the parameter if not overridden by user
  2134.        entry.
  2135.  
  2136.  
  2137.        Ex.    Default(5)
  2138.  
  2139.        Ex.    Default(system date)
  2140.  
  2141.        Ex.    Default(lookup(stock,price))
  2142.  
  2143.        The Default function is only used in form and input screen
  2144.        field derivations - It has no meaning in procedure code.
  2145.  
  2146.        Acceptable parameters
  2147.  
  2148.        Any value, expression, field, variable or nested function of
  2149.        the same type as the field in which it is used.
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.                                  - 35 -
  2187. ................................................................................
  2188.        DELAY                    FIELD CONTROL                    DELAY
  2189.  
  2190.        The "delay" control suspends processing for a given number of
  2191.        milliseconds.
  2192.  
  2193.        Ex.
  2194.  
  2195.        A procedure screen is used from a startup Batch execute menu as
  2196.        an opening screen to an application and has the following field
  2197.        derivations
  2198.  
  2199.        1.  "Welcome to this wonderful program" [delay 1000]
  2200.  
  2201.        2.  "Copyright Fred blogs"[delay 1000]
  2202.  
  2203.        3.  "Press F2 to start"
  2204.  
  2205.        If the field colours are "text" ,"alt1" or "alt2" then the
  2206.        three fields will "Popup" with a one second delay between each.
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.                                  - 36 -
  2244. ................................................................................
  2245.        DELAY                  PROCEDURE COMMAND                  DELAY
  2246.  
  2247.        The "Delay" command suspends processing for a given number of
  2248.        milliseconds (1 - 5000).
  2249.  
  2250.        Ex.
  2251.  
  2252.        declare variables
  2253.           x as number : total as number
  2254.        end
  2255.        for customers
  2256.           customers.balance = 0
  2257.           for invoices with acno = customers.acno
  2258.              display status "Totalling invoices for" + Customers.name
  2259.              delay 200
  2260.              customers.balance = customers.balance + invoices.total
  2261.           next
  2262.           update record
  2263.        next
  2264.  
  2265.        In the above example, wherever a customer only has one or two
  2266.        invoices to total, the status display would change very
  2267.        quickly.  By including a 200 millisecond delay you can ensure
  2268.        that each customers name is on screen at least long enough to
  2269.        be read.
  2270.  
  2271.        Delay values outside of 1 - 5000 are ignored.
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.                                  - 37 -
  2301. ................................................................................
  2302.        DELETE CHOICE LISTS        UTILITY          DELETE CHOICE LISTS
  2303.  
  2304.        If you have Choice lists for choice fields that are no longer
  2305.        required you can delete them with this utility.
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.                                  - 38 -
  2358. ................................................................................
  2359.        DELETE RECORD          PROCEDURE COMMAND          DELETE RECORD
  2360.  
  2361.        The "Delete Record" command is used for the selective deletion
  2362.        of records in a form.
  2363.  
  2364.        Ex.
  2365.  
  2366.        for books with title = input.title
  2367.           delete record
  2368.        next
  2369.  
  2370.        This deletes the single book whose title is that entered on the
  2371.        input screen.
  2372.  
  2373.        for books with author = input.author
  2374.           delete record
  2375.        next
  2376.  
  2377.        This deletes the records of all books by the author entered on
  2378.        the input screen.
  2379.  
  2380.        When you use the "Delete Record" command it has the same effect
  2381.        as deleting a record in data entry. In other words the record
  2382.        is marked for deletion but will not actually be removed from
  2383.        the form until the next re-pack.
  2384.  
  2385.        If you use the "Delete Record" command to delete large numbers
  2386.        of records then you should pack the form afterward.
  2387.  
  2388.        If you wish to delete all records in a form use the "Clear
  2389.        records" command not the "Delete Record" command.
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.                                  - 39 -
  2415. ................................................................................
  2416.        DERIVE OFF             PROCEDURE COMMAND             DERIVE OFF
  2417.  
  2418.        Whenever an Easy Base procedure adds or updates a record then
  2419.        by default it checks the derivations of all fields during an
  2420.        add operation and any fields that are affected by an update
  2421.        operation. In other words, if you update the netprice field in
  2422.        a stock form and that form has derived fields for VAT and
  2423.        grossprice then those fields will also be updated.
  2424.  
  2425.        If the procedure adds or updates all fields then this process
  2426.        is superfluous and simply slows the procedure. You can disable
  2427.        form derivation checking with the "Derive Off" command.
  2428.  
  2429.        derive off
  2430.        for stock with item = input.item
  2431.           copy all from input
  2432.           update record
  2433.        next
  2434.  
  2435.        In the above example a stock form has several derived fields
  2436.        but the input screen also does the same derivations. There is
  2437.        therefore no need to re-check them when the record is updated.
  2438.  
  2439.        As a general rule, in procedures which add or update records
  2440.        from an input screen, you should derive all fields on the input
  2441.        screen rather than during the update process. The user will not
  2442.        notice the time taken to derive fields while he is filling them
  2443.        in but he will notice the time taken to derive them after he
  2444.        has pressed F2
  2445.  
  2446.        There is no corresponding "Derive On" command. Derivation
  2447.        checking is automatically turned back on at the end of the
  2448.        loop to which is prefixed by the "Derive Off" command. If you
  2449.        require derivation checking to be off for more than one loop in
  2450.        a procedure then you must issue the command before each loop.
  2451.  
  2452.  
  2453.        Note:-
  2454.  
  2455.        If the "Derive Off" command is not issued before a loop then
  2456.        form level derivations override procedure derivations. This is
  2457.        not normally a problem, but can be if you try to change the
  2458.        case of a field for printing.
  2459.  
  2460.        For customers
  2461.           customers.name = proper(customers.name)
  2462.           print list items
  2463.        next
  2464.  
  2465.        If the "Name" field on the "Customers" form is derived as
  2466.        Upper(name) then the procedure will print the customers names
  2467.        in upper case.  You can overcome the problem either by
  2468.        cancelling the field derivation or by transferring the
  2469.        customers name to a variable and converting that to proper.
  2470.  
  2471.                                  - 40 -
  2472. ................................................................................
  2473.        DISPLAY STATUS         PROCEDURE COMMAND         DISPLAY STATUS
  2474.  
  2475.        If you write a procedure which has no output then Easy Base
  2476.        will display a "Running" flash at the top right hand side of
  2477.        the screen. For procedures which only take a few seconds to run
  2478.        this is sufficient to let the operator know that something is
  2479.        happening. For procedures that take some time to complete you
  2480.        should include a status display showing the progress of the
  2481.        procedure. A status display not only allays the nagging
  2482.        suspicion that the system has hung up but also allows the
  2483.        operator to estimate how long it will take.
  2484.  
  2485.        To create a status display just issue the command "Display
  2486.        Status" followed by a message composed of text in quotation
  2487.        marks and fields or variables concatenated by the + sign.
  2488.  
  2489.        Ex.
  2490.  
  2491.  
  2492.        declare variables
  2493.           x as number : y as number
  2494.        end
  2495.        for employees with taxcode = input.oldtaxcode
  2496.           y = total copies :exit for    'get copies to y for display
  2497.        next
  2498.        for employees with taxcode = input.oldtaxcode
  2499.           x = x + 1
  2500.           display status "Updating Record" + x + "of" + y
  2501.           employees.taxcode = input.newtaxcode
  2502.           update record
  2503.        next
  2504.  
  2505.        The status line is displayed centrally in a small window when
  2506.        the procedure runs. A Status line can have a maximum of 68
  2507.        characters. If you create a status line of more than 68
  2508.        characters then it will be cut short to that length.
  2509.  
  2510.        If you need to display counters in two nested loops then write
  2511.        the full display line in the outer loop and "display status"
  2512.        with no parameters in the inner loop.
  2513.  
  2514.        for customers
  2515.           x = x + 1
  2516.           - loop statements -
  2517.           display status "Checking Invoice" + y + "of customer" + x
  2518.           for invoices with customer = customers.name
  2519.              y = y + 1
  2520.              - Loop Statements -
  2521.              display status
  2522.           next
  2523.        next
  2524.  
  2525.  
  2526.  
  2527.  
  2528.                                  - 41 -
  2529. ................................................................................
  2530.        DO..LOOP               PROCEDURE COMMAND               DO..LOOP
  2531.  
  2532.        The "Do" loop structure is used in the Easy Base Procedure code
  2533.        to repeat a series of commands or statements. Whenever a
  2534.        procedure reaches a "Do" command it repeats all the statements
  2535.        between the "Do" and the "Loop" statements until the loop is
  2536.        broken by an "Exit Do" command.
  2537.  
  2538.        Ex.
  2539.  
  2540.        The following code fragment prints 10 copies of the top fifty
  2541.        best selling items in a "stock" form.
  2542.  
  2543.  
  2544.        .........................code............................
  2545.        declare output fields
  2546.           stock.item : stock.sales : today
  2547.        end
  2548.        Declare variables
  2549.           copies as number : items as number
  2550.        end
  2551.        today = system date
  2552.        do
  2553.           copies = copies + 1 :items = 0
  2554.           if copies = 11 then exit do
  2555.           bold on
  2556.           print report header
  2557.           bold off
  2558.           for stock with sales in reverse order
  2559.              items = items + 1
  2560.              if items = 51 then exit for
  2561.              print list items
  2562.           next
  2563.           bold on : print report footer : bold off
  2564.           page feed
  2565.        loop
  2566.        ............................format.....................
  2567.        .Report Header
  2568.           ═════════════════════════════════════════════════════
  2569.           Top 50 Best Selling Items               {today field}
  2570.           ═════════════════════════════════════════════════════
  2571.        .list items
  2572.              {stock.item field}        {stock.sales field}
  2573.        .Report Footer
  2574.           ═════════════════════════════════════════════════════
  2575.        .end
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.                                  - 42 -
  2586. ................................................................................
  2587.        DUPLICATE PREVENTION        METHOD         DUPLICATE PREVENTION
  2588.  
  2589.        1.  Where "Blank" values are acceptable.
  2590.  
  2591.        Quite often you will come across a situation where a field must
  2592.        not have duplicate entries but can still be left blank. You
  2593.        cannot define this field as unique because that would prevent
  2594.        more than one blank entry.  A good example of such a situation
  2595.        is in the "Menus Form" of Easy Base. The definition and unique
  2596.        field is the "Menu Title" but no two records may have the same
  2597.        entry in the sign on "Password" field.
  2598.  
  2599.        To prevent duplicate entries other than blanks you must enter a
  2600.        relationship between the form and itself with the field to be
  2601.        tested as the related field in both primary and secondary
  2602.        forms.
  2603.  
  2604.        The field is then derived as :-
  2605.  
  2606.        If(lookup(menus,password) <> blank,blank[beepDuplicate Password
  2607.                 !],password)
  2608.  
  2609.        2.   When entering records via procedures.
  2610.  
  2611.        When you use a procedure to enter a new record to a form it is
  2612.        not automatically checked as "Unique".   To ensure that
  2613.        duplicate entries are not entered via procedures you must check
  2614.        that the data entered on the procedures input screen is unique
  2615.        to the form you are about to enter it to before running the
  2616.        procedure.  For example: If you were about to enter a record to
  2617.        the "Manufacturers" form in which the "Name" field was unique
  2618.        then the "Name" field on the input screen would be derived:-
  2619.  
  2620.           if(lookup(manufacturers,name) <> blank,blank[beepDuplicate
  2621.                      Name !cursor name],name)
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.                                  - 43 -
  2643. ................................................................................
  2644.        ESCAPE ON/OFF          PROCEDURE COMMAND          ESCAPE ON/OFF
  2645.  
  2646.        When a procedure is running in Easy Base, it cannot, by
  2647.        default, be interrupted. If your procedure simply lists data to
  2648.        the screen then the end user may not need to see the entire
  2649.        output. You can allow the user to terminate a procedure
  2650.        prematurely with the "Escape On" command.
  2651.  
  2652.        If a procedure performs several tasks, you can selectively
  2653.        enable and disable the Escape Key with the commands "Escape On"
  2654.        and "Escape" Off"
  2655.  
  2656.        Ex.
  2657.  
  2658.        For newpayscales
  2659.           print list items
  2660.        next
  2661.        escape off
  2662.        for newpayscales
  2663.           for employees with scale = newpayscales.scale
  2664.              employees.rate = newpayscales.rate
  2665.              update record
  2666.           next
  2667.        next
  2668.        escape on
  2669.        for employees
  2670.           print newpay
  2671.        next
  2672.  
  2673.        In the above example a procedure lists new pay scales, updates
  2674.        the "Employees" form with the new pay rate and then lists the
  2675.        employees with their new rates.
  2676.  
  2677.        While the procedure is running the operator can terminate it
  2678.        during either of the lists but he cannot terminate it during
  2679.        the process of updating the "Employees" form.
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.                                  - 44 -
  2700. ................................................................................
  2701.        EXIT BATCH MENU        PROCEDURE COMMAND        EXIT BATCH MENU
  2702.  
  2703.        The "Exit Batch Menu" command terminates a current Batch Menu
  2704.        and returns control to the menu which called it.
  2705.  
  2706.        Ex.
  2707.  
  2708.        An application starts with a batch menu which calls a second
  2709.        batch menu which performs regular daily tasks. It then calls
  2710.        the main user menu. If the application is exited after the
  2711.        daily tasks batch menu has been completed then you will not
  2712.        wish to re-run the daily tasks when the application is
  2713.        restarted on the same day. To prevent this create a form
  2714.        "tasksdone" with a single field "date" and enter a single
  2715.        record with yesterdays date.
  2716.  
  2717.        The first procedure on the daily tasks batch menu would then be
  2718.  
  2719.        for tasksdone
  2720.           if tasksdone.date = system date then
  2721.              exit batch menu
  2722.           else
  2723.              tasksdone.date = system date
  2724.              update record
  2725.           end if
  2726.        next
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.                                  - 45 -
  2757. ................................................................................
  2758.        EXIT PROCEDURE         PROCEDURE COMMAND         EXIT PROCEDURE
  2759.  
  2760.        The "Exit Procedure" command terminates a procedure.
  2761.  
  2762.        Ex.
  2763.  
  2764.        if input.codeword <> "fred" then exit procedure
  2765.        for staffconfidential with name = input.name
  2766.           print list items
  2767.        next
  2768.  
  2769.  
  2770.        If the procedure has a repeating input screen then this is
  2771.        cancelled by the "Exit Procedure" command.
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.                                  - 46 -
  2814. ................................................................................
  2815.        FIXED POINT               FIELD TYPE                FIXED POINT
  2816.  
  2817.        Fixed point fields can display up to 14 digits. They use the
  2818.        comma for thousands separation and the full stop for decimal
  2819.        separation.
  2820.  
  2821.        There are no rounding errors with fixed point fields.
  2822.  
  2823.        See - Operators arithmetic
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.                                  - 47 -
  2871. ................................................................................
  2872.        FLOATING POINT            FIELD TYPE             FLOATING POINT
  2873.  
  2874.        Floating point fields can display up to 14 digits. They do not
  2875.        have a thousands separator. They are left justified.
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.                                  - 48 -
  2928. ................................................................................
  2929.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2930.  
  2931.        The "For" command initiates loops which load records from forms
  2932.        for processing. All statements between the "For" and the "Next"
  2933.        commands are repeated for each record selected.
  2934.  
  2935.        Ex.
  2936.  
  2937.        For Videos
  2938.           If Videos.price = 2.00 then Videos.price = 2.50
  2939.           update record
  2940.        next
  2941.  
  2942.        In the above example each record in the "Videos" form is loaded
  2943.        into memory - the price field is checked and if it is 2.00 then
  2944.        it is altered to 2.50 - the record is then updated on disk.
  2945.  
  2946.        "For" loops can be nested to any depth.
  2947.  
  2948.        Ex.
  2949.  
  2950.        for videoprices
  2951.           for videos
  2952.              if videos.price = videoprices.price then
  2953.                 print list items
  2954.              end if
  2955.           next
  2956.        next
  2957.  
  2958.        In the above example the outer loop loads each record from the
  2959.        "Videoprices" form.  While each of these is in memory it then
  2960.        loads each record from the "Videos" form, tests to see if the
  2961.        price field in "Videos" is the same as the price field in
  2962.        "Videoprices" and if so prints the list items section of the
  2963.        report format (containing the video title field) thus grouping
  2964.        all video titles by price.
  2965.  
  2966.        If a "For" loop is unqualified as above then every record is
  2967.        processed starting at one and advancing in sequence. "For"
  2968.        loops can be qualified in several ways in order to select
  2969.        records in other orders or groups. The following qualifications
  2970.        are available:-
  2971.  
  2972.        For (form) with (fieldname) in order
  2973.        For (form) with (fieldname) in reverse order
  2974.        For (form) with (fieldname) =  (value)
  2975.        For (form) with (fieldname) >  (value)
  2976.        For (form) with (fieldname) <  (value)
  2977.        For (form) with (fieldname) >= (value)
  2978.        For (form) with (fieldname) <= (value)
  2979.        For (form) new record
  2980.  
  2981.        With the exception of the "New Record" qualification, all
  2982.        accept the suffix "Unique" and an "Alias" for the form name.
  2983.  
  2984.                                  - 49 -
  2985. ................................................................................
  2986.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2987.  
  2988.        If a "For" loop is qualified by "in order" or "in reverse
  2989.        order" then the records are selected in alphabetical or reverse
  2990.        alphabetical order if the selection field is text, and in
  2991.        numeric or reverse numeric order if the selection field is
  2992.        numeric.
  2993.  
  2994.        Ex.
  2995.  
  2996.        for books with title in order
  2997.           print list items
  2998.        next
  2999.  
  3000.        Ex.
  3001.  
  3002.        for salesmen with monthlysales in reverse order
  3003.           print list items
  3004.        next
  3005.  
  3006.        If a "For" loop is qualified by "in order unique" or "in
  3007.        reverse order unique" then records will be selected in order or
  3008.        in reverse order as above. However, where there are multiple
  3009.        occurrence of the same field value a "unique" loop will only
  3010.        select the first occurrence of each value if the loop is in
  3011.        order or the last occurrence if the loop is in reverse order.
  3012.  
  3013.        Ex.
  3014.  
  3015.        for books with category in order unique
  3016.           count = count + 1
  3017.           print list items
  3018.        next
  3019.        print categorycount
  3020.  
  3021.        This example prints and counts the different categories in the
  3022.        "books" form.
  3023.  
  3024.        Ex.
  3025.  
  3026.        for theatreseats with price in reverse order unique
  3027.           for seatprices new record
  3028.              seatprices.price = theatreseats.price
  3029.           next
  3030.        next
  3031.  
  3032.        The above example selects one example only of each seat price
  3033.        in an existing "theatreseats" form in descending price order
  3034.        and enters a new record in the new "seatprices" form.
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.                                  - 50 -
  3042. ................................................................................
  3043.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3044.  
  3045.        If a "For" loop is qualified by a "Fieldname = " condition then
  3046.        only the record or records where the field contents match the
  3047.        condition will be selected.
  3048.  
  3049.        Ex.
  3050.  
  3051.        for books with category = "fiction"
  3052.           print list items
  3053.        next
  3054.  
  3055.        This example prints all books which have the category "fiction"
  3056.  
  3057.        Ex.
  3058.  
  3059.        For customers with acno = input.acno
  3060.           creditlimit = input.creditlimit
  3061.           update record
  3062.        next
  3063.  
  3064.        In this example the procedure has an input screen where the
  3065.        operator enters a customers account number and new credit
  3066.        limit. On pressing F2 the procedure finds the single record in
  3067.        the "Customers" form which has the input account number and
  3068.        updates the "creditlimit" field.
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.                                  - 51 -
  3099. ................................................................................
  3100.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3101.  
  3102.        If a "For" loop is qualified by a "with (fieldname) > " or
  3103.        "with (fieldname) >= " condition then records are selected in
  3104.        order like the "with (fieldname) in order" qualification but
  3105.        starting with the first record where the field contents match
  3106.        the condition value rather than the first record.
  3107.  
  3108.        Similarly the qualifications "with (fieldname) < " and "with
  3109.        (fieldname) <= " select records in reverse order but starting
  3110.        with the last record to match the condition value.
  3111.  
  3112.        In case you are new to progamming it should be pointed out that
  3113.        the relational operators >, <, >= and <= can be applied to text
  3114.        as well as to numbers. When they are applied to text they
  3115.        relate to the text's alphabetical order.
  3116.  
  3117.        These four qualifications provide the means to select any
  3118.        subset of records which has a range of values in a particular
  3119.        field.
  3120.  
  3121.        Ex.
  3122.  
  3123.        for pupils with age > 6
  3124.           if pupils.age = 12 then exit for
  3125.           print list items
  3126.        next
  3127.  
  3128.        This example prints the names of all pupils between the ages of
  3129.        seven and eleven. The "For" qualification starts selection in
  3130.        numeric order of age starting at seven and the "Exit for"
  3131.        command terminates the loop when the first pupil aged twelve is
  3132.        loaded.
  3133.  
  3134.        Ex.
  3135.  
  3136.        A "Videos" form has a compound index field called "catorder"
  3137.        which is derived by joining the text of the "category" and
  3138.        "title" fields. The following procedure selects all the videos
  3139.        which have the category entered on the input screen and lists
  3140.        them with the title in alphabetic order.
  3141.  
  3142.        for videos with catorder >= input.category
  3143.           if videos.category > input.category then exit for
  3144.           print list items
  3145.        next
  3146.  
  3147.        Ex.
  3148.  
  3149.        for vehicles with seats > 4 unique
  3150.           count = count + 1
  3151.        next
  3152.  
  3153.        "count" returns the number of different seat capacities > 4
  3154.  
  3155.                                  - 52 -
  3156. ................................................................................
  3157.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3158.  
  3159.        If a "For" loop is qualified by "new record" then no records
  3160.        are selected from the form. Instead, a new blank record is
  3161.        created at the "For" command, all statements between the "For"
  3162.        and "Next" commands apply to this new record and it is entered
  3163.        to the form at the "Next" command.
  3164.  
  3165.        Ex.
  3166.  
  3167.        for books new record
  3168.           books.dateinstock = system date
  3169.           copy all from input
  3170.        next
  3171.  
  3172.        This example enters a new record to the "Books" form making the
  3173.        "dateinstock" field equal the system date and copying all other
  3174.        fields from the procedures input screen.
  3175.  
  3176.        Ex.
  3177.  
  3178.        declare variables
  3179.          hourcount as number
  3180.        end
  3181.        '..............clear last wages
  3182.        clear records from wagelist
  3183.        '..........count employees hours from timesheet...
  3184.        for employees
  3185.           hourcount = 0
  3186.           for timesheet with worksno = employees.worksno
  3187.              hourcount = hourcount + timesheet.hours
  3188.           next
  3189.           for wagelist new record
  3190.              wagelist.worksno = employees.worksno
  3191.              wagelist.name = employees.name
  3192.              wagelist.hours = hourcount
  3193.              wagelist.grosswage = employees.wagerate * hourcount
  3194.           next
  3195.        next
  3196.        '.................print the wages list
  3197.        for wagelist with worksno in order
  3198.           print list items
  3199.        next
  3200.  
  3201.        This procedure starts by erasing the present contents of the
  3202.        "wagelist" form. It then selects each record from the
  3203.        "employees" form, counts all entries in the "timesheet" form
  3204.        for the employee and enters a new record in the "wagelist"
  3205.        form. Finally it prints the new wage list.
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.                                  - 53 -
  3213. ................................................................................
  3214.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3215.  
  3216.        Occasionally you may need to nest a "For" loop of a form within
  3217.        another "For" loop of the same form. If you do this, then in
  3218.        order to differentiate between the fields in the outer and
  3219.        inner loops you must allocate an "alias" name to the form in
  3220.        one of the loops. When you allocate an alias to a form name
  3221.        then all the fields of the form can also be referenced by the
  3222.        alias name.
  3223.  
  3224.        Ex.
  3225.        .......................procedure code...........
  3226.        declare output fields
  3227.           males : females : pupils.age
  3228.        end
  3229.        for pupils with age in order unique
  3230.           males = 0 : females = 0
  3231.           for pupils alias agegroups with age = pupils.age
  3232.              if agegroups.sex = "male" then
  3233.                 males = males + 1
  3234.              else
  3235.                 females = females + 1
  3236.              end if
  3237.           next
  3238.           print list items
  3239.        next
  3240.        ....................output format......................
  3241.        .list items
  3242.        There are {males} males and {females} females aged {pupils.age}
  3243.        .end
  3244.  
  3245.  
  3246.        This example counts and prints the number of male and female
  3247.        pupils in each age group.
  3248.  
  3249.        If you intend to print fields from one of the nested loops as
  3250.        the "Age" field above then you should give the alias name to
  3251.        the other loop. You can only declare an output field with the
  3252.        real form name. If you have to print fields from both loops
  3253.        then you must declare an "Ad Hoc" field and pass the alias
  3254.        fields contents to it for printing.
  3255.  
  3256.        If you need to exclude individual or groups of records from
  3257.        selection just use the "Skip Record" or "Skip Group" command.
  3258.  
  3259.        Ex.
  3260.  
  3261.        for videos with category in order
  3262.           if videos.category = "Cartoon" then skip group
  3263.           print list items
  3264.        next
  3265.  
  3266.  
  3267.  
  3268.  
  3269.                                  - 54 -
  3270. ................................................................................
  3271.        FORM LETTERS                METHOD                 FORM LETTERS
  3272.  
  3273.        To print form letters (circulars) with a different address and
  3274.        salutation for each entry in an address form simply type the
  3275.        entire letter between the .List Items and .End of the output
  3276.        format.
  3277.  
  3278.        .........................procedure code........
  3279.        Declare output fields
  3280.           Addr.name : Addr.street : Addr.town
  3281.           Addr.salutation
  3282.           date
  3283.        end
  3284.        date = datetext(system date)
  3285.        for addr
  3286.           print list items
  3287.           page feed
  3288.        next
  3289.  
  3290.        .........................output format........
  3291.        .List Items
  3292.                                               My street
  3293.                                               My county
  3294.                                               {date field  }
  3295.  
  3296.  
  3297.        {Addr.name field    }
  3298.        {Addr.street field  }
  3299.        {Addr.town field    }
  3300.  
  3301.  
  3302.        Dear {Addr.salutation},
  3303.  
  3304.            You are invited................................
  3305.        ...................................................
  3306.        ...................................................
  3307.        ..........................................
  3308.  
  3309.        Yours faithfully,
  3310.  
  3311.  
  3312.  
  3313.        Fred A Blogs
  3314.        .End
  3315.  
  3316.        Although this is the fastest way to produce a short form
  3317.        letter, the Format Editor is not the nicest place to write
  3318.        text. If you want the benefits of word wrap and spell checking
  3319.        then you can create a form in which to write the letter. Create
  3320.        text block fields to hold a page of text and a name field so
  3321.        that you can store many different letters and print them with
  3322.        the same procedure. If your letters are to be more than one
  3323.        page long then put the same name on each page.
  3324.  
  3325.  
  3326.                                  - 55 -
  3327. ................................................................................
  3328.        FORM LETTERS                METHOD                 FORM LETTERS
  3329.  
  3330.        To print the form letters from the "Letters" form your
  3331.        procedure must now have an input screen which looks up the name
  3332.        of the letter to be printed.
  3333.  
  3334.        '............................CODE.....................
  3335.        declare output fields
  3336.           addr.name : addr.street : addr.town :addr.salutation
  3337.           date :letters.block1 :letters.block2 :letters.block3
  3338.        end
  3339.        declare variables
  3340.           page as number
  3341.        end
  3342.        date = datetext(system date)
  3343.        for addr
  3344.           page = 0
  3345.           for letters with name = input.name
  3346.              page = page + 1
  3347.              if page = 1 then print list items
  3348.              if page > 1 then print extra
  3349.              page feed
  3350.           next
  3351.        next
  3352.  
  3353.        The output format is similar to that shown on the previous page
  3354.        but the text in the .list items section is replaced by the text
  3355.        block fields Letters.block1 ,letters.block2 and letters.block3
  3356.        and an additional section .extra is added which has the same
  3357.        text block fields but no address or salutation.
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.                                  - 56 -
  3384. ................................................................................
  3385.        FORMATTED TEXT            FIELD TYPE             FORMATTED TEXT
  3386.  
  3387.        If you define a field with the type "formatted text" a window
  3388.        opens up in which you enter the formatting characters. The
  3389.        characters which are to be entered by the user are shown as
  3390.        question marks. Any other characters which you enter become
  3391.        permanent fixtures in the field. The "formatted text" field can
  3392.        be up to twenty characters long and can be used for dates,
  3393.        national insurance numbers etc.
  3394.  
  3395.        Formatted text fields should not be derived.
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.                                  - 57 -
  3441. ................................................................................
  3442.        GLOBAL DEFAULTS             METHOD              GLOBAL DEFAULTS
  3443.  
  3444.        In many instances, an application will use the same default
  3445.        values in many procedures and field derivations. If you
  3446.        "hardwire" these as constants into your procedures and code
  3447.        then they will all have to be changed when the default value
  3448.        changes.
  3449.  
  3450.        Easy Base is supplied with a single global defaults form for
  3451.        VAT rates but you can create your own for any particular
  3452.        application.
  3453.  
  3454.        For instance, should you write a payroll system you would wish
  3455.        to be able to update the tax rates and bands globally
  3456.        throughout your application when they change.
  3457.  
  3458.        To do this, create a form to hold all the global defaults. In
  3459.        addition to the default fields add a single character text
  3460.        field derived "X" and index it. You then enter a single record
  3461.        with all the default values. The "X" field is there to create
  3462.        an artificial relationship between any input screen and the
  3463.        defaults form in order to lookup defaults.
  3464.  
  3465.        Wherever you need one or more global defaults in an input
  3466.        screen you simply add an invisible "x" field and enter a
  3467.        relationship between the procedure and the defaults form
  3468.        linking the "x" fields.
  3469.  
  3470.        The field "Tax" can now be derived:-
  3471.  
  3472.           taxablepay * lookup(defaults,taxrate)
  3473.  
  3474.        Similarly, you can pre load variables in procedure code for the
  3475.        default values:-
  3476.  
  3477.        Declare variables
  3478.          Taxrate1 as number:Taxrate2 as number
  3479.          Taxband1 as number:Taxband2 as number
  3480.        end
  3481.        for defaults
  3482.          Taxrate1 = defaults.taxrate1 :Taxrate2 = defaults.taxrate2
  3483.          Taxband1 = defaults.taxband1 :Taxband2 = defaults.taxband2
  3484.        next
  3485.  
  3486.        When the taxrates change you only have to alter them once in
  3487.        the Defaults form.
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.                                  - 58 -
  3498. ................................................................................
  3499.        GLOBAL NUMBER            SYSTEM VALUE             GLOBAL NUMBER
  3500.  
  3501.        The variables you create in Easy Base procedures are local
  3502.        variables - they cease to exist when the procedure ends. So
  3503.        that you can pass messages between procedures Easy base
  3504.        provides a single global variable "Global Number".  Once you
  3505.        allocate a value to "Global Number" that value remains
  3506.        unchanged (even if your computer has been turned off) until you
  3507.        allocate another value to it. You can of course pass many
  3508.        messages between procedures simply by entering records in forms
  3509.        and re-reading them but using "Global Number" is much quicker.
  3510.  
  3511.        The following example uses "Global Number" to make access to a
  3512.        user menu restricted by password.
  3513.  
  3514.        Two procedures are defined. The first, "getpassword" has a
  3515.        password field on its input screen and the following code:-
  3516.  
  3517.        if input.password = "gingerbread" then
  3518.           global number = 1
  3519.        else
  3520.           global number = 0
  3521.        end if
  3522.  
  3523.        The second procedure "checkpassword" has the following code:-
  3524.  
  3525.        if global number <> 1 then exit batch menu
  3526.        global number = 0
  3527.  
  3528.        The open access menu system has an item for the restricted menu
  3529.        but instead of calling it direct it calls the menu "Password"
  3530.        which is a batch execute menu with the items
  3531.  
  3532.        run procedure ----  getpassword
  3533.        run procedure ----  checkpassword
  3534.        user menu     ----  restricted
  3535.  
  3536.        If the password "gingerbread" has not been entered in the
  3537.        "getpassword" input screen then "checkpassword" will return
  3538.        control to the original menu.
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.                                  - 59 -
  3555. ................................................................................
  3556.        GOTO (FIELD) NEXT      DERIVATION PREFIX      GOTO (FIELD) NEXT
  3557.  
  3558.        In an Easy Base form or procedure input screen the cursor moves
  3559.        from field to field in the default order top left to bottom
  3560.        right when you press the Return key. You can alter this default
  3561.        order by deriving any field with "Goto (fieldname) next". If
  3562.        the field from which you wish to redirect the cursor already
  3563.        has a derivation formula you simply add the "Goto - Next" as a
  3564.        prefix.
  3565.  
  3566.        Ex.
  3567.  
  3568.        goto price next
  3569.  
  3570.        goto item next default(lookup(stock,name))
  3571.  
  3572.        Cursor redirection with the "Goto - next" derivation only
  3573.        occurs when the Return key is pressed it is not activated if
  3574.        you move the cursor with the directional arrow keys.
  3575.  
  3576.  
  3577.        Note: You can only have one prefix on any one field derivation.
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.                                  - 60 -
  3612. ................................................................................
  3613.        HOURS                      FUNCTION                       HOURS
  3614.  
  3615.        This function returns the hour ( 1 to 23) of the time parameter
  3616.  
  3617.        Ex.  Hour(system time)
  3618.  
  3619.        Ex.
  3620.  
  3621.        Labourcharge = (hours(endtime)-hours(starttime))* rate
  3622.  
  3623.  
  3624.        Acceptable parameters:
  3625.  
  3626.        System time
  3627.        Time field
  3628.        Maketime function
  3629.        Time expression
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.                                  - 61 -
  3669. ................................................................................
  3670.        IF                         FUNCTION                          IF
  3671.  
  3672.        Ex.  if(num >= 0,"Positive","negative")
  3673.  
  3674.        The first parameter of the "if" function is an expression, the
  3675.        second is the value to be returned if the expression is true
  3676.        and the third is the value to be returned if the expression is
  3677.        false.
  3678.  
  3679.        If the third parameter is omitted and the expression is false
  3680.        then the field or variable retains any value it had before the
  3681.        function was called.
  3682.  
  3683.        The "if" function can be extended to a full "case" function
  3684.        simply by adding more expressions and return values.
  3685.  
  3686.        Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  3687.  
  3688.        There is no limit to the number of expressions and return
  3689.        values. If more than one expression is true the value returned
  3690.        is that for the first true expression. If none are true then
  3691.        the trailing value is returned as the "case else".
  3692.  
  3693.        Acceptable Parameters:
  3694.  
  3695.        Numeric expressions
  3696.        Quoted text
  3697.        Fields and variables
  3698.        Other nested functions
  3699.        System Values
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.                                  - 62 -
  3726. ................................................................................
  3727.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3728.  
  3729.        Easy Base recognizes the following "If Then Else"
  3730.        constructions.
  3731.  
  3732.        1.    if (condition) then (action)
  3733.              ------------------------------------------
  3734.        2.    if (condition) then (action) else (action)
  3735.              ------------------------------------------
  3736.        3.    if (condition) then
  3737.                 (action)
  3738.                 (action)
  3739.                 (action)
  3740.              end if
  3741.              -----------------------------------------
  3742.        4.    if (condition) then
  3743.                 (action)
  3744.                 (action)
  3745.              else
  3746.                 (action)
  3747.                 (action)
  3748.              end if
  3749.  
  3750.        If then constructions can be nested to any depth.
  3751.  
  3752.        if (condition) and (condition) then
  3753.           (action)
  3754.           if (condition) or (condition) then
  3755.              (action)
  3756.              (action)
  3757.           else
  3758.              (action)
  3759.              if (condition) eqv (condition) then (action)
  3760.              (action)
  3761.           end if
  3762.           if (condition) then (action)
  3763.        else
  3764.           (action)
  3765.        end if
  3766.  
  3767.        Easy base does not interpret "Else if" constructions.
  3768.  
  3769.        Easy base does not interpret two "if" conditions on one line.
  3770.  
  3771.  
  3772.        In the above examples "action" applies to any Easy base command
  3773.        or full "Do Loop" or full "For Next" structure.
  3774.  
  3775.        You cannot split a "Do Loop" structure and you can only split a
  3776.        "For Next" structure by a simple "If then" and "End if" with no
  3777.        "else" command.
  3778.  
  3779.        Ex. on next page.
  3780.  
  3781.  
  3782.                                  - 63 -
  3783. ................................................................................
  3784.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3785.  
  3786.        In the following example the procedure has an input screen with
  3787.        a field "type". "type" is a choice field with the choices "In
  3788.        age order", "In alphabetic order" and "By sex". The procedure
  3789.        code selects one of three listings from the "Pupils" form by
  3790.        splitting "For Next" structures by "If Then" structures.
  3791.  
  3792.        if input.type = "in age order" then
  3793.           for pupils with age in order
  3794.        end if
  3795.        if input.type = "in alphabetic order" then
  3796.           for pupils with name in order
  3797.        end if
  3798.        if input.type = "by sex" then
  3799.           for pupils with sex in order
  3800.        end if
  3801.           print list items
  3802.        next
  3803.        next
  3804.        next
  3805.  
  3806.        The structure above is the only one in which "For Next"
  3807.        structures can be split. There must be a separate "If Then"
  3808.        followed by "End If" for each "For". There must be a "Next for
  3809.        each "For"  and there cannot be an "Else" anywhere in the
  3810.        construction.
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.                                  - 64 -
  3840. ................................................................................
  3841.        INDEX OFF              PROCEDURE COMMAND              INDEX OFF
  3842.  
  3843.        When an Easy Base procedure adds, updates or deletes a record
  3844.        then by default it updates any affected index files. As the
  3845.        majority of transaction procedures act on a single record this
  3846.        is the fastest method of processing. It does of course require
  3847.        that the form is periodically re-packed.  If, however, a
  3848.        procedure is to add, update or delete many records then
  3849.        updating each affected index file on each iteration of the
  3850.        "For" loop can be much slower than ignoring the indices during
  3851.        the loop and re-writing them from scratch afterward.
  3852.  
  3853.        You can take the "re-write" option by issuing the command
  3854.        "Index off" before the "For" loop.
  3855.  
  3856.        index off
  3857.        for employees
  3858.          for wagelist new record
  3859.             wagelist.worksno = employees.worksno
  3860.             wagelist.taxcode = employees.taxcode
  3861.          next
  3862.        next
  3863.  
  3864.        Obviously re-writing an entire index file when only one or two
  3865.        records are affected would be slower than simply updating the
  3866.        indices. The actual point at which "Index Off" becomes faster
  3867.        can only be determined by trial but as a general rule the two
  3868.        systems take equal time when between 12 and 15 percent of the
  3869.        records of a file are affected and the advantage of "Index Off"
  3870.        becomes greater the bigger this percentage.
  3871.  
  3872.        There is no corresponding "Index On" command. Indexing is
  3873.        turned back on automatically and the index files are re-written
  3874.        at the end of the loop to which the command applies. If you
  3875.        require indexing off during more than one loop you must issue
  3876.        the command before each.
  3877.  
  3878.        index off
  3879.        for invoices with date < makedate(05,04,93)
  3880.           delete records
  3881.        next
  3882.        index off
  3883.        for invoices with customer = "john smith"
  3884.           invoices.customer = "John Smith Ltd"
  3885.           update record
  3886.        next
  3887.  
  3888.        If you prefix a loop which deletes records from a form then the
  3889.        form is packed at the end of the loop.
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.                                  - 65 -
  3897. ................................................................................
  3898.        Input Screen Format         METHOD          Input Screen Format
  3899.  
  3900.        All form and input screens can be presented either mounted in a
  3901.        window against a mottled background or exactly as drawn in form
  3902.        design. The windowing effect is done automatically if you leave
  3903.        a clear border around all text and fields. If you place fields
  3904.        or text anywhere against the edge of the screen (even invisible
  3905.        fields) then the window effect will not be invoked.
  3906.  
  3907.        If you do not want the window effect but you still wish to
  3908.        leave a clear border then you should place the invisible text
  3909.        character (ASCII 255) in the top left hand corner of the
  3910.        screen to disable it. To produce the invisible character hold
  3911.        down the Alt Key and type 255 on the numeric keypad.
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.                                  - 66 -
  3954. ................................................................................
  3955.        INSTALL FORM               UTILITY                 INSTALL FORM
  3956.  
  3957.        The "Install Form" utility is accessed from the Utilities menu.
  3958.        If you wish to include a form in one application which you
  3959.        designed in another then you cannot simply copy the files to
  3960.        the new applications directory as there will be no entry in the
  3961.        "Forms Directory" file.
  3962.  
  3963.        To install a form from another application - first get the
  3964.        forms DOS filename from that application then select "Install
  3965.        Form" from the utilities menu. You will be asked to supply the
  3966.        forms name and the full path and filename from where it is to
  3967.        be copied. Easy Base will then copy the forms definition file
  3968.        and make the appropriate entry in the "Forms Directory". It
  3969.        will then ask whether or not you wish the data to be copied
  3970.        from the original application.
  3971.  
  3972.        If you install a form from another application and it has
  3973.        "lookup" derivations or Choice List fields then you will have
  3974.        to create the relationships and choice lists in the new
  3975.        application. They are not automatically reproduced.
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.                                  - 67 -
  4011. ................................................................................
  4012.        INSTALL PRINTER            UTILITY              INSTALL PRINTER
  4013.  
  4014.        The "Install printer" utility is accessed from the Utilities
  4015.        menu. It can also be included in a user menu so that end users
  4016.        of finished applications can install their printer without
  4017.        access to the system menus.
  4018.  
  4019.        When you select "Install Printer" you are offered a choice of
  4020.        ten printer drivers - five for named printers and five generic
  4021.        drivers. The drivers supplied cover virtually all printers
  4022.        except daisy wheels.
  4023.  
  4024.        When you have chosen your printer driver Easy Base then asks
  4025.        for the parallel port number to which printer output is to be
  4026.        sent - one or two. Easy Base does not have a built in serial
  4027.        port printer output. If your printer only has a serial input
  4028.        then you must redirect a parallel port with the DOS "Mode"
  4029.        command.
  4030.  
  4031.        Easy Base then asks how much paper wastage there is at the top
  4032.        of the page. This is quite important as it is used in
  4033.        conjunction with the paper size in use to determine the
  4034.        "Bottom Margin" value, used for pagination in printed reports.
  4035.  
  4036.        You are then asked for the wastage at the left margin. This
  4037.        information is used in the format editor to display the right
  4038.        edge of the paper at the different print sizes. There are only
  4039.        two settings for wastage at the left margin - zero and ¼ inch.
  4040.        If you have a cartridge fed printer such as a Laser or Bubble
  4041.        Jet then it will almost certainly be ¼ inch. If you have a
  4042.        traction or manual feed then you will be able to adjust the
  4043.        left margin and you should set it to zero.
  4044.  
  4045.        Finally you are asked for the top margin required in printed
  4046.        reports. This can only be between the value set as the printers
  4047.        inherent wastage and one inch.  The value you set here will be
  4048.        the default top margin for all printouts. If you need a larger
  4049.        top margin for certain printouts then you must include blank
  4050.        lines in the page header of the procedures output format.
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.                                  - 68 -
  4068. ................................................................................
  4069.        INSTALL PROCEDURE          UTILITY            INSTALL PROCEDURE
  4070.  
  4071.        The "Install procedure" utility is accessed from the
  4072.        Utilities menu and allows you to install procedures which you
  4073.        designed in another application. It is used exactly like the
  4074.        "Install Form" utility previously described.
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.                                  - 69 -
  4125. ................................................................................
  4126.        INTEGER                   FIELD TYPE                    INTEGER
  4127.  
  4128.        Integer fields can have up to 14 digits and use a comma as the
  4129.        thousands separator.
  4130.  
  4131.        Although integer fields display integers they store the result
  4132.        of any division correct to 15 significant figures.
  4133.  
  4134.        See - Operators Arithmetic
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.                                  - 70 -
  4182. ................................................................................
  4183.        INTEXT                     FUNCTION                      INTEXT
  4184.  
  4185.        This function returns the starting character number of one
  4186.        length of text within another.
  4187.  
  4188.        Ex.    Intext(companyname," and ")
  4189.               < Returns 7 if companyname = "Turner and Smith"
  4190.  
  4191.        The intext function returns 0 if the second parameter is not
  4192.        found in the first.
  4193.  
  4194.        Ex.
  4195.  
  4196.        If intext(customers.companyname," Ltd") <> 0 then
  4197.           customers.Ltd  = "yes"
  4198.           update record
  4199.        end if
  4200.  
  4201.        Acceptable parameters:
  4202.  
  4203.        Text field/variable
  4204.        Any function returning a text value
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.                                  - 71 -
  4239. ................................................................................
  4240.        JOINTEXT                   FUNCTION                    JOINTEXT
  4241.  
  4242.        Ex.  Jointext(forename,surname)
  4243.  
  4244.        The jointext function takes any number of parameters.
  4245.  
  4246.        Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  4247.        Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  4248.  
  4249.        The "jointext" function will also perform any arithmetic
  4250.        operations required for a text output.
  4251.  
  4252.        Ex. Jointext("The Gross price is ",netprice *120/100)
  4253.  
  4254.        The "jointext" function is also used for creating compound
  4255.        index fields.
  4256.  
  4257.        Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  4258.  
  4259.        This creates a field whose index allows a stock file to be
  4260.        listed with stockitem in alphabetical order but grouped by
  4261.        price in reverse order.
  4262.  
  4263.        If you "Jointext" a date or time field you will get the date or
  4264.        time's numeric value not the date or time's string
  4265.        representation. (See Compound Index)
  4266.  
  4267.        By default the "Jointext" function strips trailing blank space
  4268.        characters from the texts being joined. If you wish to join
  4269.        text in a Text Block field so that the second text starts on a
  4270.        new line then you can force this by including Chr$(13) which
  4271.        Easy base uses as a "New Line" flag.
  4272.  
  4273.        Ex.
  4274.  
  4275.            Jointext(block1,chr$(13),block2)
  4276.  
  4277.            <The text from block2 will start on a new line>
  4278.  
  4279.        Ex.
  4280.  
  4281.            Jointext(block1,chr$(13),chr$(13),block2)
  4282.  
  4283.           <There will be a blank line between block1 and block2>
  4284.  
  4285.        Acceptable Parameters:
  4286.  
  4287.        Numeric expressions
  4288.        Quoted text
  4289.        Fields and variables
  4290.        Other nested functions
  4291.        System Values
  4292.  
  4293.  
  4294.  
  4295.                                  - 72 -
  4296. ................................................................................
  4297.        LEFTTEXT                   FUNCTION                    LEFTTEXT
  4298.  
  4299.        This function returns a specified number of characters from the
  4300.        start of a field or variable.
  4301.  
  4302.        Ex.   Lefttext(salutation,2)
  4303.              < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  4304.  
  4305.        Ex.   Lefttext(datetext(system date),4)
  4306.              < Returns 12th , 20th Etc.>   (European date format)
  4307.  
  4308.  
  4309.  
  4310.  
  4311.        Acceptable parameters:
  4312.  
  4313.        Text field/variable
  4314.        Any function returning a text value
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.                                  - 73 -
  4353. ................................................................................
  4354.        LENGTHTEXT                 FUNCTION                  LENGTHTEXT
  4355.  
  4356.        This function returns the length of text in a field or variable
  4357.  
  4358.        Ex.   lengthtext(name)
  4359.              < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  4360.  
  4361.  
  4362.        Acceptable parameters:
  4363.  
  4364.        Text field/variable
  4365.        Any function returning a text value
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.                                  - 74 -
  4410. ................................................................................
  4411.        LIST FILE NAMES            UTILITY              LIST FILE NAMES
  4412.  
  4413.        When you give a name to a Form or Procedure in Easy Base it is
  4414.        not the actual DOS file name used. A Form has separate DOS
  4415.        files for its definition, its data and its indices. Similarly a
  4416.        procedure can have one or two files depending on whether or not
  4417.        it has an input screen. Within an application you never need to
  4418.        know the DOS filenames as Easy Base takes care of all disk
  4419.        activity in the background.
  4420.  
  4421.        You may however need to know the DOS filenames if you intend to
  4422.        export data to another program or copy a Form or Procedure from
  4423.        one application to another.
  4424.  
  4425.        You can list the DOS filenames for Forms and reports with the
  4426.        "List File Names" utility.
  4427.  
  4428.        The "List File Names" utility can also be called from a user
  4429.        menu without accessing the system.
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.                                  - 75 -
  4467. ................................................................................
  4468.        LIST VARIABLES         PROCEDURE COMMAND         LIST VARIABLES
  4469.  
  4470.        The "List Variables" command is a de-bugging facility for
  4471.        developers. If a procedure is not producing the expected
  4472.        results you can interrupt it at any point and view the contents
  4473.        of all fields and variables in memory at that point.
  4474.  
  4475.        Ex.
  4476.  
  4477.        for authors with surname in order
  4478.           if authors.surname = "kippling" then list variables
  4479.           for books with author = authors.surname
  4480.              print list items
  4481.           next
  4482.        next
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.                                  - 76 -
  4524. ................................................................................
  4525.        LOOKUP                     FUNCTION                      LOOKUP
  4526.  
  4527.        Ex. Lookup(customers,name)
  4528.  
  4529.        The first parameter is the name of a relationship defined in
  4530.        the relationships form. The second parameter is the name of the
  4531.        field in the secondary file whose value is to be looked up. The
  4532.        parameters are absolute. You cannot supply them as variables
  4533.        fields or the results of other functions.
  4534.  
  4535.        Unlike other functions, "lookup" can only be used in a field
  4536.        derivation, entry conditions and mandatory conditions. It has
  4537.        no meaning in the procedure language.
  4538.  
  4539.        A full description of how to use the Lookup function is given
  4540.        in the users manual
  4541.  
  4542.        Acceptable parameters
  4543.  
  4544.        1.   Relationship name
  4545.        2.   Field Name
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.                                  - 77 -
  4581. ................................................................................
  4582.        LOWER                      FUNCTION                       LOWER
  4583.  
  4584.        Returns the lower case of the parameter.
  4585.  
  4586.        Ex. lower(partname)
  4587.  
  4588.  
  4589.        Ex.
  4590.  
  4591.        Heading = Jointext("List of parts supplied by ",lower(makers.
  4592.        name))
  4593.  
  4594.  
  4595.        Acceptable parameters:
  4596.  
  4597.        Quoted text
  4598.        Text Field/variable
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.  
  4634.  
  4635.  
  4636.  
  4637.                                  - 78 -
  4638. ................................................................................
  4639.        MAKEDATE                   FUNCTION                    MAKEDATE
  4640.  
  4641.        The Easy base Date field is a six digit field which covers the
  4642.        century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  4643.        perform addition and subtraction operations in days.
  4644.  
  4645.        Ex. Duedate = Invoicedate + 30
  4646.  
  4647.        In order to provide this facility the date is held as a numeric
  4648.        value. You can only type a date directly into a date field.
  4649.  
  4650.        If you need to enter a date in a derivation or in a procedure
  4651.        code you must use the "makedate" function.
  4652.  
  4653.        Ex.  Makedate(5,11,95)
  4654.            < Returns 05/11/95 >
  4655.  
  4656.        Ex.  Nextmonth = month(system date)+1
  4657.             if nextmonth = 13 then nextmonth = 1
  4658.             Nextdelivery = makedate(1,nextmonth,year(system date))
  4659.             < Returns the date of the first of next month >
  4660.  
  4661.        Acceptable parameters
  4662.  
  4663.        Numeric value
  4664.        Numeric expression
  4665.        Numeric field/variable
  4666.        Any other function which returns a numeric value
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.                                  - 79 -
  4695. ................................................................................
  4696.        MAKETIME                   FUNCTION                    MAKETIME
  4697.  
  4698.        The value of a time field in Easy base is held as a numeric
  4699.        value representing the number of seconds past midnight. This
  4700.        allows you to perform addition and subtraction operations in
  4701.        seconds.
  4702.  
  4703.        Ex. Timetaken = Round(Endtime - Starttime / 60)
  4704.            < This returns the time taken in minutes >
  4705.  
  4706.        You can only enter a time directly into a time field.
  4707.  
  4708.        If you need to enter a time in a field derivation or in a
  4709.        procedure code you must use the "Maketime" function.
  4710.  
  4711.        Ex. Time = Maketime(20,20,00)
  4712.             <  returns 20:20:00  >
  4713.  
  4714.  
  4715.        Acceptable parameters:
  4716.  
  4717.        Numeric value
  4718.        Numeric expression
  4719.        Numeric field/variable
  4720.        Any other function which returns a numeric value
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.                                  - 80 -
  4752. ................................................................................
  4753.        MATHS                      FUNCTION                       MATHS
  4754.  
  4755.        The following maths functions can be used anywhere in Easy Base
  4756.        code or field derivations.
  4757.  
  4758.        Log()
  4759.        Log10()
  4760.        Sqrt()
  4761.        Sin()
  4762.        Cos()
  4763.        Tan()
  4764.        Atan()
  4765.        Deg-rad()     converts degrees to radians
  4766.        Rad-deg()     converts radians to degrees
  4767.        Exp()         Raises e (the base of natural logarithms) to the
  4768.                      power of the parameter
  4769.  
  4770.  
  4771.        Acceptable parameters:
  4772.  
  4773.        Numeric value
  4774.        Numeric expression
  4775.        Numeric field/variable
  4776.        Any function returning a numeric value
  4777.  
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.                                  - 81 -
  4809. ................................................................................
  4810.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4811.  
  4812.        Because the procedures you create in Easy Base have to be
  4813.        interpreted each time they are run they will tend to be slower
  4814.        than similar routines created in a compiled system. This is the
  4815.        unavoidable cost of ease of use. You can increase speed vastly
  4816.        by having the best DOS environment and by the way in which you
  4817.        write procedure code.
  4818.  
  4819.        DOS Environment.
  4820.  
  4821.        1.   Do not use a disk compression system.
  4822.  
  4823.        2.   Always load "Fastopen"  - The default settings are fine -
  4824.             just add the line "fastopen C:" to your AUTOEXEC.BAT file.
  4825.  
  4826.        3.   Use a Disk Cacheing system - The more memory you can
  4827.             allocate to it the better. Easy Software recommends
  4828.             PC-Cache from Centre Point with 2 Megabytes of expanded
  4829.             memory allocated. Smartdrive (Version supplied with
  4830.             Windows 3.1) was slightly faster but caused widespread
  4831.             disk corruptions during test "Power Failures".
  4832.        4.   Do not run any TSR programs (Especially Virus Checkers).
  4833.  
  4834.        Procedure Code.
  4835.  
  4836.        Avoid making calculations and derivations within "For" loops in
  4837.        procedures.
  4838.  
  4839.        If, for example, you had a form in which was recorded the
  4840.        length, breadth and depth of various blocks and you knew that
  4841.        at some point you would write a procedure which listed their
  4842.        volume. Add a field for volume to the form and derive it from
  4843.        the other fields. When you write the procedure you will simply
  4844.        list this field. If the field had not been added to the form
  4845.        then you would have to calculate its value on each iteration of
  4846.        the "For" loop.
  4847.  
  4848.        The time taken to derive each individual "Volume" field during
  4849.        record entry will not be noticeable but the time taken to
  4850.        derive the volume for every record during the procedure will.
  4851.  
  4852.        Keep "Running statistics".  If your program requires statistics
  4853.        derived from many hundreds or even thousands of records then
  4854.        having to wait for a procedure which calculates them each time
  4855.        you want up to date figures is a real pain.
  4856.  
  4857.        To keep "running statistics" create a form with a field for
  4858.        each statistic you require and enter a single record with zero
  4859.        values in each field. Make all entries, modifications and
  4860.        deletions to your data via procedures and you can update your
  4861.        statistics each time a record is added, modified or deleted.
  4862.  
  4863.        Example on next page.
  4864.  
  4865.                                  - 82 -
  4866. ................................................................................
  4867.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4868.  
  4869.        The following procedure code enters a record (collected via the
  4870.        input screen) to a purchases ledger and updates statistics used
  4871.        in the profit and loss account. It also updates the balance for
  4872.        the suppliers account.
  4873.  
  4874.        pause off : Escape off
  4875.        for purchases new record
  4876.           copy all from input
  4877.        next
  4878.        for stats
  4879.           if input.type = "Invoice" then
  4880.              stats.creditors = stats.creditors + input.amount
  4881.           end if
  4882.           if input.type = "CreditNote" then
  4883.              stats.creditors = stats.creditors - input.amount
  4884.           end if
  4885.           if input.type = "Payment" then
  4886.              stats.creditors = stats.creditors - input.amount
  4887.              if input.paidby = "cash" then
  4888.                 stats.cashbalance = stats.cashbalance - input.amount
  4889.              else
  4890.                 stats.bankbalance = stats.bankbalance - input.amount
  4891.              end if
  4892.           end if
  4893.        next
  4894.        for ACbalances with supplier = input supplier
  4895.           if input.type = "Invoice" then
  4896.              ACbalances.balance = ACbalances.balance + input.amount
  4897.           else
  4898.              ACbalances.balance = ACbalances.balance - input.amount
  4899.           end if
  4900.        next
  4901.  
  4902.        Whenever you need to know statistics for "Debtors", "Cash
  4903.        Balance" etc you can produce them instantly with a procedure
  4904.        which simply lists data from the statistics forms.
  4905.  
  4906.        Whenever you use running statistics in this way you should also
  4907.        create a procedure which does calculate them from the raw data.
  4908.        If you ever, for one reason or another, have to edit data
  4909.        directly in "Data entry" then your "running statistics" will no
  4910.        longer be accurate. You can run this procedure to correct them.
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.                                  - 83 -
  4923. ................................................................................
  4924.        MENU CALLS               MENU FUNCTION               MENU CALLS
  4925.  
  4926.        In addition to the utilities which can be called from user
  4927.        menus the following calls can also be made.
  4928.  
  4929.        Run Procedure :   Runs a pre-defined procedure
  4930.  
  4931.        Last Output   :   Recalls the output from a procedure
  4932.  
  4933.        Data Entry    :   Allows direct access to a form
  4934.  
  4935.        User Menu     :   Calls another user menu
  4936.  
  4937.        System Menus  :   Calls the Easy Base System menus
  4938.  
  4939.        Run external program :  Shells to another program - You cannot
  4940.        run another major program from within Easy Base - there is very
  4941.        little spare memory - this call is however useful for calling
  4942.        batch files which export data to other programs for later use.
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.                                  - 84 -
  4980. ................................................................................
  4981.        MIDTEXT                    FUNCTION                     MIDTEXT
  4982.  
  4983.        This function returns a given number of characters from a given
  4984.        starting point in a field or variable.
  4985.  
  4986.        Ex.   Midtext(fileref,4,4)
  4987.              < Returns "Bill" from "TR/Bill/1243"
  4988.  
  4989.  
  4990.        Acceptable parameters:
  4991.  
  4992.        Text field/variable
  4993.        Any function returning a text value
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.                                  - 85 -
  5037. ................................................................................
  5038.        MINUTES                    FUNCTION                     MINUTES
  5039.  
  5040.        This function returns the minutes number from the time field
  5041.        parameter.
  5042.  
  5043.        Ex.    minutes(system time)
  5044.  
  5045.        Ex.
  5046.  
  5047.        Unitsperhour = rounddown(60/(minutes(endtime)-
  5048.        minutes(starttime)))
  5049.  
  5050.        Acceptable parameters:
  5051.  
  5052.        System time
  5053.        Time field
  5054.        Maketime function
  5055.        Time expression
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.                                  - 86 -
  5094. ................................................................................
  5095.        MOD                        FUNCTION                         MOD
  5096.  
  5097.        The Mod function returns the remainder of an integer division
  5098.  
  5099.        Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  5100.  
  5101.  
  5102.        Ex.
  5103.  
  5104.        for Historydates
  5105.           historydates.leapyear = "No"
  5106.           if mod(historydates.year,4) = 0 then
  5107.              historydates.leapyear = "Yes"
  5108.              update record
  5109.           end if
  5110.        next
  5111.        < This example fills a new field "leapyear" which has been
  5112.        added to the "Historydates" form after data has been entered>
  5113.  
  5114.        Acceptable parameters:
  5115.  
  5116.        Numeric value
  5117.        Numeric expression
  5118.        Numeric field/variable
  5119.        Any other function which returns a numeric value
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.                                  - 87 -
  5151. ................................................................................
  5152.        MONTH                      FUNCTION                       MONTH
  5153.  
  5154.        This function returns the month number from a date parameter.
  5155.  
  5156.        Ex.    Month(system date)
  5157.  
  5158.        Ex.    Month(birthdate)
  5159.  
  5160.  
  5161.        Acceptable parameters
  5162.  
  5163.        System date
  5164.        Date field
  5165.        Makedate function
  5166.        Date expression
  5167.  
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.  
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.                                  - 88 -
  5208. ................................................................................
  5209.        MULTIPLE COLUMNS            METHOD             MULTIPLE COLUMNS
  5210.  
  5211.        You may occasionally need to list data in order but in more
  5212.        than one column. Indexes for technical manuals are a common
  5213.        example. It would be nice if you could send the printer head
  5214.        back to the top of the page for each column but you can't. You
  5215.        must therefore get all the data for each horizontal line into
  5216.        memory at the same time and then print it.
  5217.  
  5218.        The following example prints the "Title" field from a "Films"
  5219.        form in alphabetic order in two columns with fifty lines on
  5220.        each page. To do this a field "No" is added to the form. This
  5221.        is an integer field and it is indexed.
  5222.  
  5223.        declare output fields
  5224.           films.title : righttitle
  5225.        end
  5226.        declare variables
  5227.           x as number  : y as number : lasttitle as text
  5228.        end
  5229.        '................UPDATE THE No FIELD......
  5230.        for films with title in order
  5231.           y = total records
  5232.           x = x + 1
  5233.           display status "Updating No field record" + x + "of" + y
  5234.           films.No = x
  5235.           update record
  5236.        next
  5237.        '.................PRINT IN TWO COLUMNS.................
  5238.        x = 0                        'reuse x as counter
  5239.        do
  5240.           for films with title > lasttitle
  5241.              x = x + 1
  5242.              for films alias col2 with No = films.No + 50
  5243.                righttitle = col2.title
  5244.              next
  5245.              print list items
  5246.              lasttitle = righttitle : righttitle = blank
  5247.              if mod(x,50) = 0 then
  5248.                 page feed : Exit for
  5249.              end if
  5250.           next
  5251.           if lasttitle = blank then exit do
  5252.        loop
  5253.  
  5254.        ........................Format..................
  5255.  
  5256.        .list items
  5257.              { Films.title field  }      {  Righttitle Field  }
  5258.        .end
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.                                  - 89 -
  5265. ................................................................................
  5266.        MULTIPLE LINES         PROCEDURE COMMAND         MULTIPLE LINES
  5267.  
  5268.        You can place multiple code instructions on a single line of
  5269.        the code editor by separating them with a colon.
  5270.  
  5271.        Ex.
  5272.  
  5273.        for ledger with lineno = input.lineno
  5274.           ledger.net = input.net:ledger.vat = input.vat
  5275.           ledger.acno = input.acno:ledger.gross = input.gross
  5276.           update record
  5277.        next
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.                                  - 90 -
  5322. ................................................................................
  5323.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5324.  
  5325.        If you want to print procedure output on both sides of the
  5326.        paper then, unless you have a VERY expensive printer, the only
  5327.        way to achieve this is to print the odd pages, turn your paper
  5328.        over and print the even pages.  For a short report you can do
  5329.        this by setting paper feed to "Manual" from the utilities menu
  5330.        and turning each sheet over individually. If, however, you have
  5331.        a cut sheet feeder or a cartridge fed printer it is much
  5332.        quicker to print all the odd pages, turn them all over and then
  5333.        print all the even pages.
  5334.  
  5335.        To do this in Easy Base, issue the command "Odd Page Print"
  5336.        immediately before the print output and "Even Page Print"
  5337.        immediately after it.
  5338.  
  5339.        declare output fields
  5340.           customers.name : customers.phone
  5341.        end
  5342.        odd page print
  5343.        for customers with surname in order
  5344.           if bottom margin < .75 then page feed
  5345.           print list items
  5346.        next
  5347.        even page print    '(Easy Base pauses here till you are ready)
  5348.  
  5349.        If you will be binding your printed report down the left hand
  5350.        edge then you will need a larger left margin on the odd pages
  5351.        than on the even. If you start odd page printing with the
  5352.        command "Odd Page Print for Binding" then Easy Base will add
  5353.        half an inch to the format left margin when it prints the odd
  5354.        pages. You cannot alter the fixed value of half an inch but if
  5355.        you create your output format with a left margin of half an
  5356.        inch(suitable for the even pages) and print for binding, you
  5357.        will find that the resulting output suits most office binding
  5358.        systems.
  5359.  
  5360.        If you use Odd/Even page printing then it is important that you
  5361.        realize it is achieved by running the portion of your procedure
  5362.        between the "Odd Page Print" and "Even Page Print" twice -
  5363.        simply cancelling output to the printer at the appropriate
  5364.        times.  You must not, therefore include any commands which add,
  5365.        update or delete records between the commands. If you do they
  5366.        will be performed twice. Similarly if you are running a loop
  5367.        counter during the print process then it will have double the
  5368.        expected value after the "Even Page Print" command.
  5369.  
  5370.        The system value "Page Number" is reset to one at the "Even
  5371.        Page Print" command. If you include two separate sets of odd
  5372.        and even printing in a single procedure then you cannot use
  5373.        "Page Number" to number the second printout. You can of course
  5374.        use an ad hoc field. Just remember to reset it to one
  5375.        immediately before the "Even Page Print" command.
  5376.  
  5377.  
  5378.                                  - 91 -
  5379. ................................................................................
  5380.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5381.  
  5382.        This document was written in an Easy Base form "Ref" which has
  5383.        fields "Name", "Type", "Pageno" "Topicpage" and three text
  5384.        block fields "T1", "T2" and "T3". Each record holds one page of
  5385.        the reference manual and the pages were entered in no
  5386.        particular order. The following procedure was used to number,
  5387.        sort, index and print the manual.
  5388.  
  5389.        declare output fields
  5390.           ref.name : ref.type :ref.pageno
  5391.           ref.t1 : ref.t2 : ref.t3 : type : name
  5392.        end
  5393.        declare variables
  5394.           x as number : y as number
  5395.           namelen as number : typelen as number
  5396.        end
  5397.        '.....................NUMBER REFERENCE PAGES....
  5398.        for ref with name in order
  5399.           y = total records
  5400.           x = x + 1
  5401.           display status "Numbering page" + x + "of" + y
  5402.           ref.pageno = x : update record
  5403.        next
  5404.        odd page print for binding
  5405.        '...............PRINT COMMANDS INDEX........
  5406.        bold on : print commandheader : bold off
  5407.        for ref with type = "procedure command"
  5408.           subindex name
  5409.        next
  5410.        for ref with subindex in order
  5411.           if topicpage > 1 then skiprec  'only first page
  5412.           ref.name = proper(ref.name)    'of each topic listed
  5413.           print commands
  5414.        next
  5415.        '..............PRINT SYSTEM VALUES INDEX...
  5416.        bold on : print valuesheader : bold off
  5417.        for ref with type = "system value"
  5418.           subindex name
  5419.        next
  5420.        for ref with subindex in order
  5421.           if topicpage > 1  then skiprec
  5422.           ref.name = proper(ref.name)
  5423.           print values
  5424.        next
  5425.        page feed       '... eject first index page
  5426.  
  5427.        '......... subsequent index pages are produced with exactly
  5428.        '........ the sane code as above and are omitted for clarity.
  5429.  
  5430.        '......................MAIN REFERENCE.............
  5431.        page feed
  5432.        for ref with name in order
  5433.           namelen = lengthtext(ref.name)
  5434.  
  5435.                                  - 92 -
  5436. ................................................................................
  5437.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5438.  
  5439.           typelen = lengthtext(ref.type)
  5440.           '....centre justify type
  5441.           type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  5442.           '....right justify name
  5443.           name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  5444.           bold on : print refheader : bold off  'type and names fields
  5445.           print list items                      't1, t2, t3
  5446.           bold on print reffoot                 'pageno
  5447.           page feed
  5448.        next
  5449.        even page print
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.                                  - 93 -
  5493. ................................................................................
  5494.        OPERATORS                 ARITHMETIC                  OPERATORS
  5495.  
  5496.        The arithmetic operators used in Easy Base are:-
  5497.  
  5498.        +   (addition)
  5499.  
  5500.        -   (subtraction and negation)
  5501.  
  5502.        *   (multiplication)
  5503.  
  5504.        /   (division)
  5505.  
  5506.        ^   (exponentiation)
  5507.  
  5508.        Where there are multiple operators in a derivation they are
  5509.        processed with the following precedence:-
  5510.  
  5511.        1.   Exponentiation
  5512.        2.   Negation
  5513.        3.   Multiplication and Division
  5514.        4.   Addition and Subtraction
  5515.  
  5516.        The default precedence can be altered by the use of
  5517.        parenthesis.
  5518.  
  5519.             Easy base does not perform Integer Arithmetic.
  5520.  
  5521.        When a numeric field shows the result of a division the
  5522.        "displayed" number is "truncated" to an integer in Integer
  5523.        fields and has the last digit rounded in Fixed Point and
  5524.        Floating Point fields.  The "Stored" value which is used in any
  5525.        further calculations, however, is always correct to 15
  5526.        significant figures irrelevant of field type.  For Example: If
  5527.        three fields x,y and z are defined as integers, y is derived as
  5528.        x/4 and z is derived as y*4 then when 9 is entered in x, y will
  5529.        derive as 2 but z will derive as 9 because it multiplies the
  5530.        "stored value" of 2.25 by 4 not the displayed value of 2.
  5531.  
  5532.        Handling arithmetic in this way means that, by default there
  5533.        are no rounding errors. This has several advantages not least
  5534.        that currency values need only ever be defined to two decimal
  5535.        places.
  5536.  
  5537.        It does mean, however, that should you require rounding errors
  5538.        to be carried forward you must use one of the Easy Base
  5539.        rounding functions on the result of any intermediate division.
  5540.  
  5541.        In the above example, had y been derived as "round(x/4)" then z
  5542.        would derive as 8.
  5543.  
  5544.        If a fourth field had the formula:- if(y = 2,5,10) it would
  5545.        only derive as 5 if y had been rounded or if 8 had been entered
  5546.        in x.
  5547.  
  5548.  
  5549.                                  - 94 -
  5550. ................................................................................
  5551.        OPERATORS                 RELATIONAL                  OPERATORS
  5552.  
  5553.        Easy base uses the following relational operators:-
  5554.  
  5555.        =    (equals)
  5556.        <>   (not equals)
  5557.        >    (greater than)
  5558.        <    (less than)
  5559.        >=   (greater than or equal to)
  5560.        <=   (less than or equal to)
  5561.  
  5562.  
  5563.        Where relational operators and arithmetic operators are both
  5564.        used in a derivation. Relational operations are performed after
  5565.        arithmetic operations.
  5566.  
  5567.        Text values are not case sensitive when compared with
  5568.        relational operators.
  5569.  
  5570.        When you compare two fields or variables, the comparison is
  5571.        numeric if both are numeric and alphabetic if both are
  5572.        alphabetic.  If you compare a numeric field with a text field
  5573.        then Easy Base will test to see if the text field contains a
  5574.        number.  If it does then the comparison will be numeric and if
  5575.        it does not then the comparison will be alphabetic.
  5576.  
  5577.        WARNING
  5578.  
  5579.        If you compare the result of a division in an integer or fixed
  5580.        point field using the = or the <> operators, then the value
  5581.        used for comparison will be the (accurate) stored value and not
  5582.        the "Truncated" number shown in the field.
  5583.  
  5584.        See Operators Arithmetic
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.                                  - 95 -
  5607. ................................................................................
  5608.        OPERATORS                  LOGICAL                    OPERATORS
  5609.  
  5610.        Easy Base uses the following logical operators:-
  5611.  
  5612.        1.  and
  5613.        2.  or
  5614.        3.  xor     (or exclusive)
  5615.        4.  eqv     (equivalence)
  5616.        5.  imp     (implication)
  5617.  
  5618.        Logical operations are performed last after arithmetic and
  5619.        relational.
  5620.  
  5621.        Logical operators return a boolean (true or false) value from
  5622.        two other boolean expressions.
  5623.  
  5624.        Ex.
  5625.  
  5626.        If(x = y and a = b,"Yes","No")
  5627.           < Yes is returned if both expressions are true >
  5628.  
  5629.        If(x = y or a = b,"Yes","No")
  5630.           < Yes is returned if either or both expressions are true >
  5631.  
  5632.        If(x = y xor a = b,"Yes","No")
  5633.           < Yes is returned if either one but not both are true >
  5634.  
  5635.        If(x = y eqv a = b,"Yes","No")
  5636.           < Yes is returned if both expressions are true or if both
  5637.             expressions are false >
  5638.  
  5639.        If(x = y imp a = b,"Yes","No")
  5640.  
  5641.           < Yes is returned for all combinations except the first
  5642.             expression being true and the second false >
  5643.  
  5644.        The Easy Base logical operators are primarily designed for use
  5645.        within the "If" function and in "If..Then..Else" constructions
  5646.        where their actual value is not relevant. If you wish to use
  5647.        the value of "false" in formulae then it is represented by 0.
  5648.        True can be represented by any value other than 0 and should
  5649.        not be used.
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.                                  - 96 -
  5664. ................................................................................
  5665.        OPTIONS                    UTILITY                      OPTIONS
  5666.  
  5667.        The "Options" utility allows you to select your preferred date
  5668.        format (European or North American).
  5669.  
  5670.        You can also enable or disable screen saving. If enabled the
  5671.        screen saver operates after three minutes without a keypress
  5672.        during record entry, procedure screen entry or if a menu is
  5673.        being displayed. The screensaver is never invoked while a
  5674.        procedure is running or while reformatting or re-indexing is
  5675.        taking place.
  5676.  
  5677.        The third option allows you to select the border style you
  5678.        require around menus and message boxes.
  5679.  
  5680.        Option four selects whether or not screen clearing will be done
  5681.        with the curtain effect.
  5682.  
  5683.        The options utility can be called as a user menu function so
  5684.        that an end user can access the facilities without access to
  5685.        the system menus.
  5686.  
  5687.  
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.                                  - 97 -
  5721. ................................................................................
  5722.        OUTPUT                   SYSTEM VALUE                    OUTPUT
  5723.  
  5724.        When a user runs a procedure his choice of output, screen,
  5725.        printer or disk is stored in the system value "Output".
  5726.  
  5727.        By accessing the system value "Output" you can make your
  5728.        procedure do different things depending on where the output is
  5729.        to be sent.
  5730.  
  5731.        Ex.
  5732.  
  5733.        if output = "screen" then
  5734.           print heading1
  5735.        else
  5736.           print heading2
  5737.        end if
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.                                  - 98 -
  5778. ................................................................................
  5779.        PACK DATA FORMS            UTILITY              PACK DATA FORMS
  5780.  
  5781.        The process of actually removing a deleted record from a form
  5782.        is time consuming. What actually happens is that all the "Live"
  5783.        records are copied to a temporary file. The original file is
  5784.        then deleted and the temporary one re-named to the original
  5785.        name. Because of this it is actually quicker to remove fifty
  5786.        "Dead" records than it is to remove one. To save you time Easy
  5787.        base follows the traditional data-base custom of simply marking
  5788.        records for deletion when you delete them. They are only
  5789.        physically removed from the form during a "Pack" operation.
  5790.        When you "Pack" a data file Easy Base also re-writes all the
  5791.        index files for that form. You can pack individual forms with
  5792.        the "Pack Data Forms" utility accessed from the Utilities menu.
  5793.        You can also call the "Pack Data Forms" utility as a User menu
  5794.        function. In a finished application any necessary packing would
  5795.        normally be done from a batch execute menu which would run
  5796.        while the computer was unattended.
  5797.  
  5798.        Forms in which records are regularly deleted should be packed
  5799.        regularly. If packing is not done then not only will you be
  5800.        wasting disk space but search operations will become
  5801.        progressively slower as the percentage of "Dead" records
  5802.        increases.
  5803.  
  5804.        This is fairly obvious - however it is not so obvious that a
  5805.        forms index files can accumulate "Dead" records even though
  5806.        none have been deleted from the main file. An index file is
  5807.        simply the indexed fields contents and record number arranged
  5808.        in order. If, having filed a record you then alter the contents
  5809.        of an indexed field and update the record then the original
  5810.        record in the index file is deleted and a new one entered.
  5811.  
  5812.        Index files with "Dead records" also waste disk space and slow
  5813.        search operations. You should therefore regularly pack any
  5814.        forms which are regularly updated.
  5815.  
  5816.        If you are unsure which forms need to be packed you can use the
  5817.        "Auto-Pack" utility which tests each form and each forms index
  5818.        files for "Dead" records. The form is packed if it or any of
  5819.        its index files is found to have more then 100 total or 10 per
  5820.        cent "Dead" records.
  5821.  
  5822.        Although "Auto-Pack" may seem the easy answer, an application
  5823.        will almost certainly have several forms with "Core" data which
  5824.        remain unchanged and therefore never require packing. If you
  5825.        can identify the forms which do need to be packed and do them
  5826.        individually or from a batch execute menu this will be less
  5827.        time consuming than always using the "Auto-Pack" facility.
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.                                  - 99 -
  5835. ................................................................................
  5836.        PAGE NUMBER              SYSTEM VALUE               PAGE NUMBER
  5837.  
  5838.        Whenever Easy Base is processing a procedure with an output it
  5839.        keeps track of the current page number (Even if you have not
  5840.        included Page Feed commands). You can use the system value
  5841.        "Page Number" to number the pages of your output. To use the
  5842.        "Page Number" value just include "Page Number" in your output
  5843.        field declarations.
  5844.  
  5845.        Declare output fields
  5846.           Customers.name : Customers.ACNO : Page Number
  5847.        end
  5848.  
  5849.        You can then use the "Page Number" field in the Page Header or
  5850.        Page Footer section of your output format.
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.  
  5891.                                  - 100 -
  5892. ................................................................................
  5893.        PAUSE ON/OFF           PROCEDURE COMMAND           PAUSE ON/OFF
  5894.  
  5895.        When an Easy Base procedure has an output to the screen, the
  5896.        output, by default scrolls continuously until the procedure is
  5897.        complete. You can allow the user to pause the output with the
  5898.        "Pause On" command.
  5899.  
  5900.        If a procedure performs several tasks then the pause facility
  5901.        can be selectively enabled and disabled at any point.
  5902.  
  5903.        Ex.
  5904.  
  5905.        for employees alias types with type in order unique
  5906.           pause off:escape off
  5907.           for employees alias group with type = types.type
  5908.              subindex surname
  5909.           next
  5910.           pause on
  5911.           for employees with subindex in order
  5912.              print list items
  5913.           next
  5914.        next
  5915.  
  5916.        The above code fragment prints employees details in type groups
  5917.        with surname in alphabetic order. During the procedure the user
  5918.        can pause the report while it is listing the output but not
  5919.        while it is subindexing the group.
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.  
  5948.                                  - 101 -
  5949. ................................................................................
  5950.        PI                       SYSTEM VALUE                        PI
  5951.  
  5952.        You can use the value of π anywhere in field derivations or
  5953.        procedure code by quoting "Pi".
  5954.  
  5955.        Ex     circlearea = Pi / 4 diam^2
  5956.  
  5957.  
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.                                  - 102 -
  6006. ................................................................................
  6007.        PRESELECT              PROCEDURE COMMAND              PRESELECT
  6008.  
  6009.        The "Preselect" command sets highlighting of the next user menu
  6010.        when the procedure terminates.  If a procedure is normally
  6011.        followed by a particular selection from the menu then you can
  6012.        save the user the trouble of choosing it by issuing the
  6013.        "Preselect" command within the procedure.
  6014.  
  6015.        for currentcustomer
  6016.           currentcustomer.acno = input.acno
  6017.           update record
  6018.        next
  6019.        preselect 4
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.                                  - 103 -
  6063. ................................................................................
  6064.        PRINT                  PROCEDURE COMMAND                  PRINT
  6065.  
  6066.        In Easy Base procedures, all output to the screen or printer is
  6067.        initiated with the "Print" command. The "Print" command prints
  6068.        sections from the procedures output format.
  6069.  
  6070.        Ex.
  6071.  
  6072.        '......................procedure code....
  6073.        Print report header
  6074.        for customers
  6075.           print list items
  6076.        next
  6077.        print report footer
  6078.        '......................Output Format.......
  6079.        .Report Header
  6080.              ════════════════════════════════════════════════
  6081.                            Customer List
  6082.              ════════════════════════════════════════════════
  6083.        .List Items
  6084.              {customers.name field}  {customers.phone field}
  6085.        .Report Footer
  6086.              ════════════════════════════════════════════════
  6087.        .end
  6088.  
  6089.        The format sections are marked with a full stop in the margin
  6090.        followed by the section name. When you type a full stop in the
  6091.        margin of the "Format editor" Easy Base will offer you a
  6092.        selection of section names. You do not have to use these - they
  6093.        are just some common names that can save you time. To enter
  6094.        your own section names just press escape and type in any name
  6095.        you wish.
  6096.  
  6097.        The ".end" section is not strictly necessary but it is easy to
  6098.        accidentally insert blank lines at the end of your format. By
  6099.        inserting ".end" at the end of the last section you will
  6100.        prevent these from being printed.
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.  
  6108.  
  6109.  
  6110.  
  6111.  
  6112.  
  6113.  
  6114.  
  6115.  
  6116.  
  6117.  
  6118.  
  6119.                                  - 104 -
  6120. ................................................................................
  6121.        PRINTER CONTROL        PROCEDURE COMMAND        PRINTER CONTROL
  6122.  
  6123.        When you send a procedure output to the printer Easy Base will
  6124.        initialize your printer at ten characters per inch, six lines
  6125.        per inch in draft mode.
  6126.  
  6127.        You can alter the printer mode anywhere within a procedure with
  6128.        the following printer controls.
  6129.  
  6130.        Bold On            Bold Off
  6131.        Underline On       Underline Off
  6132.        Italic On          Italic Off
  6133.        NLQ On             NLQ Off
  6134.  
  6135.        8 lpi      Sets printing to eight lines per inch
  6136.        6 lpi      Sets printing to six lines per inch
  6137.        10 cpi     Sets printing to ten characters per inch
  6138.        12 cpi     Sets printing to twelve characters per inch
  6139.        17 cpi     sets printing to either 15 or 17 depending on
  6140.                   printer
  6141.        Line Feed  Advances the print head one line
  6142.        Page Feed  Ejects the current page.
  6143.  
  6144.        Ex.
  6145.        NLQ On
  6146.        Bold on
  6147.        Print report header
  6148.        Bold Off
  6149.        12 CPI
  6150.        For customers
  6151.           print list items
  6152.           if bottom margin < 1.5 then
  6153.              Line feed : Bold On : 10 CPI
  6154.              Print Page footer
  6155.              Page feed
  6156.              Print Page header
  6157.              Bold Off : 12 CPI
  6158.           end if
  6159.        next
  6160.        Bold on:Italic On :10 CPI
  6161.        print report footer
  6162.  
  6163.        The above example turns Near Letter Quality printing on for the
  6164.        entire report. It prints page headers and footers in bold at 10
  6165.        characters per inch, list items at 12 characters per inch and
  6166.        the report footer in bold italics.
  6167.  
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.  
  6174.  
  6175.  
  6176.                                  - 105 -
  6177. ................................................................................
  6178.        PROPER                     FUNCTION                      PROPER
  6179.  
  6180.        This function returns the parameter with the first letter of
  6181.        each word in upper case and the rest in lower case. If you wish
  6182.        to enter initials in a field derived as proper and keep them in
  6183.        upper case then there must either be a space or a full stop
  6184.        between them.
  6185.  
  6186.        Ex.     Proper(Address)
  6187.  
  6188.        Ex.
  6189.  
  6190.        labelname = upper(company.name)
  6191.        insetname = proper(company.name)
  6192.  
  6193.  
  6194.        Acceptable parameters:
  6195.  
  6196.        Quoted text
  6197.        Text field/variable
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.                                  - 106 -
  6234. ................................................................................
  6235.        Q AND A INPUT SCREEN        METHOD         Q AND A INPUT SCREEN
  6236.  
  6237.        If, for a procedure you have to collect many items of data via
  6238.        an input screen, then presenting all the fields and their
  6239.        labels at once can be confusing to an operator.  You can start
  6240.        with an empty screen other than the first field and its prompt
  6241.        then have each subsequent prompt "Pop up" when the previous
  6242.        field has been filled.
  6243.  
  6244.        To do this you make all your input fields without a background
  6245.        (Text, Alt1 or Alt2) and you create fields for the prompts
  6246.        which have no user entry and also show no background.
  6247.  
  6248.        Ex.
  6249.  
  6250.        To collect data for paymethod, customer, and amount lay out the
  6251.        following fields:-
  6252.  
  6253.                Enter Method of payment....     { Paymethod Field }
  6254.                { Pop1 Field               }    { Customer Field  }
  6255.                { Pop2 Field               }    { Amount Field   }
  6256.  
  6257.        The "Pop1" field is derived:-
  6258.  
  6259.           If(Pop1 = blank and paymethod = blank,blank,"Enter Customers
  6260.                   name.........")
  6261.  
  6262.        and the "Pop2" field is derived:-
  6263.  
  6264.           If(Pop2 = blank and customer = blank,blank,"Enter Amount...
  6265.                  ...............")
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.                                  - 107 -
  6291. ................................................................................
  6292.        RANDOM                     FUNCTION                      RANDOM
  6293.  
  6294.        This function returns a random number between the upper and
  6295.        lower parameters.
  6296.  
  6297.        Ex.  Random(1,100)
  6298.           <Returns a random number between 1 and 100>
  6299.  
  6300.        Ex.  The two fields No and card simulate the random cutting of
  6301.        a deck of cards each time the No field is cleared.
  6302.  
  6303.        No field derivation:-
  6304.            if(no <> blank,no,random(1,52))
  6305.  
  6306.        Card field derivation:-
  6307.  
  6308.            jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  6309.        mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  6310.        " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  6311.        ,"Spades"))
  6312.  
  6313.  
  6314.        Acceptable parameters
  6315.  
  6316.        Numeric Value
  6317.        Numeric expression
  6318.        Numeric field/variable
  6319.        Any other function which returns a numeric value
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.  
  6346.  
  6347.                                  - 108 -
  6348. ................................................................................
  6349.        REBUILD DIRECTORIES        UTILITY          REBUILD DIRECTORIES
  6350.  
  6351.        In Easy Base, all DOS file handling is taken care of for you in
  6352.        the background. To do this Easy Base maintains three
  6353.        "Directory" files in which the names which you give to forms,
  6354.        procedures and choice field lists are linked to the actual DOS
  6355.        filenames.
  6356.  
  6357.        The three files are :-
  6358.  
  6359.        BASE.DIR     The forms directory
  6360.        PROC.DIR     The procedures directory
  6361.        CHOICES.DIR  The choice list directory
  6362.  
  6363.        Because these are key files, Easy Base includes a utility which
  6364.        will rebuild them in the event of accidental erasure or
  6365.        corruption.
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.                                  - 109 -
  6405. ................................................................................
  6406.        RECORD NUMBER            SYSTEM VALUE             RECORD NUMBER
  6407.  
  6408.        If you derive a field with the formula "record number" it will
  6409.        be filled with the record number at the time of filing or
  6410.        reformatting.  Record number differs from "sequence" in the
  6411.        following way. Each time you derive a field with "sequence" you
  6412.        get the next sequencial number irrespective of whether the form
  6413.        has had records deleted and has been repacked. If a file has
  6414.        had at some time 500 records but now only has 20 the next
  6415.        derivation of "sequence" will be 501 and the next derivation of
  6416.        "record number" will be 21.
  6417.  
  6418.        The main use of "record number" is to renumber a set of records
  6419.        after deletions. To do this just add a new field to the form
  6420.        derived as record number. The field will be filled
  6421.        automatically during the data reformatting process.
  6422.  
  6423.        Record Number has no meaning in procedure code.
  6424.  
  6425.        See Also:-  Current Record Number
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.                                  - 110 -
  6462. ................................................................................
  6463.        REMARK                 PROCEDURE COMMAND                 REMARK
  6464.  
  6465.        You can place remarks anywhere within Easy base procedure code
  6466.        by prefixing them with an apostrophe.
  6467.  
  6468.        Ex.
  6469.  
  6470.        '.................This entire line is a remark.....
  6471.        for pupils with age > 9
  6472.           if grade = "g" then skip record   'exclude g's from count
  6473.           count = count + 1                 'These are remarks
  6474.        next
  6475.        '..............................................
  6476.  
  6477.        All text to the right of the apostrophe is ignored at run time.
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.                                  - 111 -
  6519. ................................................................................
  6520.        RESTORE                    UTILITY                      RESTORE
  6521.  
  6522.        Easy Base will restore applications or data which it has backed
  6523.        up. You can only restore an application with the "Restore
  6524.        Application" utility called from the utilities menu and you can
  6525.        only restore data-only backups with the "Restore Data" utility
  6526.        called from a user menu.
  6527.  
  6528.  
  6529.        See Also:-  Backup
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.                                  - 112 -
  6576. ................................................................................
  6577.        RETAIL                     FUNCTION                      RETAIL
  6578.  
  6579.        The retail function returns the retail price given the
  6580.        wholesale price and the discount as a percentage of retail.
  6581.  
  6582.        Ex   Retail(cost,discount)
  6583.  
  6584.             < returns 125 if cost = 100 and discount = 20>
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.  
  6624.  
  6625.  
  6626.  
  6627.  
  6628.  
  6629.  
  6630.  
  6631.  
  6632.                                  - 113 -
  6633. ................................................................................
  6634.        RETEST                 DERIVATION PREFIX                 RETEST
  6635.  
  6636.        In Easy Base, fields are derived when a new record is started
  6637.        and when any other field which affects the derivation is
  6638.        changed. You can force a field to be rederived when F2 is
  6639.        pressed by prefixing the derivation with "retest".
  6640.  
  6641.        Suppose you have a field "degrees" in which the user must enter
  6642.        a number between 1 and 360.
  6643.  
  6644.        To prevent him entering an out of range number you could derive
  6645.        the field :-
  6646.  
  6647.        If(degrees<1 or degrees > 360,blank[beepInvalid number of
  6648.        degreesCursor degrees],degrees)
  6649.  
  6650.        The above derivation would prevent the user from filing a
  6651.        record with an out of range number. However, by the time he
  6652.        read the message, his entry would be blanked out. It would be
  6653.        better if the number he had typed could be left in the field so
  6654.        that he could see his error. To do this all you have to do is
  6655.        change "blank" to "degrees" in the above derivation.
  6656.  
  6657.        This however would allow the user ( Should he decide to ignore
  6658.        the message ) to then file the incorrect value. To leave the
  6659.        value in the field and still prevent the user from filing it,
  6660.        use the "retest" prefix.
  6661.  
  6662.        Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  6663.        of degreesCursor degrees],degrees)
  6664.  
  6665.  
  6666.        Note: You can only have one prefix on any one field derivation.
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.  
  6682.  
  6683.  
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689.                                  - 114 -
  6690. ................................................................................
  6691.        REVERSE                    FUNCTION                     REVERSE
  6692.  
  6693.        The reverse function is used in the creation of compound index
  6694.        fields. What it actually does is alter the characters of the
  6695.        parameter in such a way that an alphabetic listing of a field
  6696.        after reversal will have the reverse order to that of the
  6697.        original characters before using the reverse function.
  6698.  
  6699.        In the example shown for the function "zeropad", had you wished
  6700.        to list the pupils in descending age order there would be no
  6701.        point in using the procedure code:
  6702.  
  6703.        for pupils with unifield in reverse order
  6704.  
  6705.        as this would not only reverse the age grouping but would also
  6706.        reverse the name order.
  6707.  
  6708.        To produce the desired printout use exactly the same procedure
  6709.        but derive "unifield" as:-
  6710.  
  6711.        Jointext(reverse(zeropad(age,2,0)),name)
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.  
  6740.  
  6741.  
  6742.  
  6743.  
  6744.  
  6745.  
  6746.                                  - 115 -
  6747. ................................................................................
  6748.        RIGHTTEXT                  FUNCTION                   RIGHTTEXT
  6749.  
  6750.        This function returns a specified number of characters from the
  6751.        end of a field or variable.
  6752.  
  6753.        Ex    Righttext(name,10)
  6754.  
  6755.  
  6756.        Ex.   Righttext(datetext(system date),4)
  6757.              < returns  1993 , 1994 Etc.>
  6758.  
  6759.  
  6760.        Acceptable parameters:
  6761.  
  6762.        Text field/variable
  6763.        Any function returning a text value
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.                                  - 116 -
  6804. ................................................................................
  6805.        ROUND                      FUNCTION                       ROUND
  6806.  
  6807.        There are three rounding functions in Easy base:-
  6808.  
  6809.        Round
  6810.        Roundup
  6811.        Rounddown
  6812.  
  6813.        If a rounding function is called with a single parameter then
  6814.        the return value is the parameter rounded to the nearest
  6815.        integer value.
  6816.  
  6817.        Ex. Round(items/reps)
  6818.           < if items = 9 and reps = 4. 2 is returned >
  6819.  
  6820.        All rounding functions accept a second parameter indicating the
  6821.        number of decimal places (or powers of 10 if negative) to round
  6822.        to.
  6823.  
  6824.        Ex. Rounddown(vaton(net),2)
  6825.           < Rounds down the VAT on field "net" to the nearest penny.
  6826.  
  6827.        Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  6828.            )/100,"th Century")
  6829.  
  6830.          < Returns "20th Century" for all values of years 1900-1999 >
  6831.  
  6832.  
  6833.        Round Produces a default rounding system in which:-
  6834.  
  6835.           2.4 rounds to  2
  6836.           2.5 rounds to  3
  6837.          -2.4 rounds to -2
  6838.          -2.5 rounds to -3
  6839.  
  6840.        In the Roundup and Rounddown functions the direction is sign
  6841.        sensitive:-
  6842.  
  6843.           2.5 roundsup to  3      2.5 roundsdown to  2
  6844.          -2.5 roundsup to -2     -2.5 roundsdown to -3
  6845.  
  6846.        Acceptable parameters:
  6847.  
  6848.        Numeric value
  6849.        Numeric expression
  6850.        Numeric field/variable
  6851.        Any other function which returns a numeric value
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.                                  - 117 -
  6861. ................................................................................
  6862.        RUN                      FIELD CONTROL                      RUN
  6863.  
  6864.        The "run" control is used to initiate procedures with input
  6865.        screens without the user having to press F2.
  6866.  
  6867.        Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  6868.              name)[run])
  6869.  
  6870.        In the above example, a procedure which lists customers
  6871.        accounts has an input screen with a single field where the
  6872.        customers name is entered. When the user enters a name the
  6873.        above derivation will test whether or not the entered name is a
  6874.        customer. If the entered name does not exist in the customers
  6875.        file the field will be blanked out but if it does then the
  6876.        procedure will run without the user having to press F2.
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.                                  - 118 -
  6918. ................................................................................
  6919.        RUNTIME AUTO START          METHOD           RUNTIME AUTO START
  6920.  
  6921.        If you intend to distribute an application using the Easy Base
  6922.        Runtime Module, you can have the module start automatically on
  6923.        a particular user menu by giving that menu the sign on password
  6924.        "Autostart".
  6925.  
  6926.        Each time the runtime module starts it searches for a menu with
  6927.        this password. If it finds one, it skips the sign on screen and
  6928.        starts automatically on this menu.
  6929.  
  6930.        The "Autostart" password has no significance while developing
  6931.        in Easy Base. It is treated as any other sign on password.
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.                                  - 119 -
  6975. ................................................................................
  6976.        SCREEN COLOURS             UTILITY               SCREEN COLOURS
  6977.  
  6978.        The "Screen Colours" utility provides 14 pre defined colour
  6979.        sets including two for "Mono Graphics" cards together with a
  6980.        user defined setup. To change the colours of your system simply
  6981.        select "Screen Colours" from the Utilities menu and select the
  6982.        set you want.
  6983.  
  6984.        The "Screen Colours" utility can also be called as a User Menu
  6985.        function allowing an end user to change his screen set from
  6986.        your menus without accessing the system.
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.  
  7029.  
  7030.  
  7031.                                  - 120 -
  7032. ................................................................................
  7033.        SECONDS                    FUNCTION                     SECONDS
  7034.  
  7035.        This function returns the seconds number from the time
  7036.        parameter.
  7037.  
  7038.        Ex.    seconds(system time)
  7039.  
  7040.  
  7041.        Acceptable parameters:
  7042.  
  7043.        System time
  7044.        Time field
  7045.        Maketime function
  7046.        Time expression
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.                                  - 121 -
  7089. ................................................................................
  7090.        SEQUENCE                 SYSTEM VALUE                  SEQUENCE
  7091.  
  7092.        When you create a new form a sequence value is updated each
  7093.        time a record is entered. The "sequence" value starts at 1 and
  7094.        continues to 2 billion irrespective of whether or not records
  7095.        have been deleted from the form. If you derive a field as
  7096.        "sequence" then each new record will have the next sequenced
  7097.        number. Sequence derivations are useful for such things as
  7098.        invoice numbers.
  7099.  
  7100.        A sequence field need not start at one however.
  7101.  
  7102.        Ex.  sequence + 1000 would number the first record 1001
  7103.  
  7104.        The sequence value is only available in data entry to a form.
  7105.        A common problem in data systems is to produce a sequence
  7106.        number when records are entered to forms via procedures.
  7107.  
  7108.        To accomplish this define fields to hold the number on both the
  7109.        form and the procedure input screen. Also define a single
  7110.        character text field, let's call it x on both. This field can
  7111.        be invisible. The x field in the form is indexed but not
  7112.        derived. The x field on the input screen is derived as "x".
  7113.        A relationship, let's call it "invoice" is entered between the
  7114.        input screen and the form relating the two "x" fields.
  7115.        Assuming the fields for the sequence number are called "invno"
  7116.        the field on the input screen is derived as:-
  7117.  
  7118.           lookup(invoice,invno)+ 1
  7119.  
  7120.        To update the x field in the form which is used purely as a
  7121.        flag to mark the last record your procedure code would be
  7122.        something like:-
  7123.  
  7124.        for invoices with x = "x"
  7125.           invoices.x = blank
  7126.           update record
  7127.        next
  7128.        for invoices new record
  7129.           copy all from input
  7130.        next
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.                                  - 122 -
  7146. ................................................................................
  7147.        SET PAPER LENGTH           UTILITY             SET PAPER LENGTH
  7148.  
  7149.        The "Set Paper Length" utility is accessed from the
  7150.        Utilities menu and can also be called from a user menu.
  7151.  
  7152.        There are settings for A3, A4, A5, American Letter and
  7153.        American Legal in both portrait and landscape.
  7154.  
  7155.        When you change the paper length in use then you update
  7156.        pagination for all report outputs.
  7157.  
  7158.        The landscape options are for use in wide carriage printers
  7159.        where the paper can be fed in landscape orientation they do not
  7160.        produce "sideways" printing on narrow carriage printers.
  7161.  
  7162.  
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.                                  - 123 -
  7203. ................................................................................
  7204.        SKIP GROUP             PROCEDURE COMMAND             SKIP GROUP
  7205.  
  7206.        The "Skip Group" command excludes an entire group of records
  7207.        from selection by a "For" loop.
  7208.  
  7209.        Ex.
  7210.  
  7211.        for employees with type in order
  7212.           if employees.type = "Part time" then skip group
  7213.           print list items
  7214.        next
  7215.  
  7216.        The "Skip Group" command is not the same as filtering with a
  7217.        "<>" condition.  You could achieve the same result with :-
  7218.  
  7219.        for employees with type in order
  7220.           if employees.type <> "Part time" then
  7221.              print list items
  7222.           end if
  7223.        next
  7224.  
  7225.        but the second procedure would take much longer to run as each
  7226.        part time employee's record would be loaded into memory only to
  7227.        be rejected by the "If" condition.  The first procedure on the
  7228.        other hand only loads a single part time employee's record then
  7229.        skips the entire group by advancing the index pointer in use
  7230.        for record selection.
  7231.  
  7232.        You can also use the "Skip Group" command to terminate
  7233.        selection of a group of records at a given point.
  7234.  
  7235.        declare variables
  7236.           count as number
  7237.        end
  7238.        for employees with type in order
  7239.           count = count + 1
  7240.           if count = 51 then
  7241.              count = 0
  7242.              skip group
  7243.           end if
  7244.           print list items
  7245.        next
  7246.  
  7247.        The above procedure prints the first fifty employees in each
  7248.        "type" group.
  7249.  
  7250.        The "Skip Group" command can be shortened to "Skipgrp"
  7251.  
  7252.        IMPORTANT: The condition for the Skip Group cannot be nested
  7253.        within another "If" condition or "DO LOOP" structure which is
  7254.        itself within the current "For" loop.
  7255.  
  7256.        :- See Skip Record for example.
  7257.  
  7258.  
  7259.                                  - 124 -
  7260. ................................................................................
  7261.        SKIP RECORD            PROCEDURE COMMAND            SKIP RECORD
  7262.  
  7263.        The "Skip Record" command is used to exclude individual records
  7264.        from selection in a "For" Loop.
  7265.  
  7266.        Ex.
  7267.  
  7268.        for employee with worksno in order
  7269.           if employees.worksno = 12 then skip record
  7270.           print list items
  7271.        next
  7272.  
  7273.        The "Skip Record" command has exactly the same effect as
  7274.        filtering with a "<>" condition but is much easier to write if
  7275.        there are many items to exclude
  7276.  
  7277.        for employees with worksno in order
  7278.           if employees.worksno = 12 or employees.worksno = 15 then
  7279.              skip record
  7280.           end if
  7281.           if employees.name = "smith" then skip record
  7282.           if employees.age > 50 then skip record
  7283.        next
  7284.  
  7285.        You can exclude groups of records from an inner loop by
  7286.        applying the "Skip Record" command to a "Unique" outer loop.
  7287.  
  7288.        for employees alias types with type in order unique
  7289.           if types.type = "director" then skip record
  7290.           if types.type = "part time" then skip record
  7291.           for employees with type = types.type
  7292.              print list items
  7293.           next
  7294.        next
  7295.  
  7296.        If you need to exclude groups of records from a single loop you
  7297.        must use the "Skip Group" command.
  7298.  
  7299.        The "Skip Record" command can be shortened to "Skiprec".
  7300.  
  7301.        IMPORTANT:
  7302.  
  7303.        The Skip Record command causes a direct jump to the start of
  7304.        the next iteration of the current "For" loop. The condition
  7305.        for the Skip Record must not be nested within another "If"
  7306.        condition or "Do Loop" structure which is itself within the
  7307.        current For loop.
  7308.  
  7309.        for form
  7310.           if (condition) then
  7311.              if form.type = "Part time" then skip record
  7312.           end if
  7313.        next
  7314.                     This will cause a system error.
  7315.  
  7316.                                  - 125 -
  7317. ................................................................................
  7318.        SPACEPAD                   FUNCTION                    SPACEPAD
  7319.  
  7320.        The Spacepad function pads a text variable to a given length
  7321.        with spaces.
  7322.  
  7323.        Ex.   Spacepad(name,10)
  7324.              < returns "Fred      " if name = "Fred"
  7325.  
  7326.        The spacepad function is used in the creation of compound index
  7327.        fields.
  7328.  
  7329.        For example:    A "Films" form has the fields "title" and
  7330.        "category". To list the films grouped by category in order and
  7331.        with the titles in each category in order create the field
  7332.        "groupindex" as text,long enough to hold both category and
  7333.        title fields and derived as :-
  7334.  
  7335.        Jointext(spacepad(category,15),title)
  7336.                        {15 is length of category field}
  7337.  
  7338.        You can then produce the required printout with the following
  7339.  
  7340.        procedure.
  7341.  
  7342.        ....................format.........................
  7343.  
  7344.        .Report header
  7345.          ═══════════════════════════════════════════════════════════
  7346.                         FILM LIST BY CATEGORY
  7347.          ═══════════════════════════════════════════════════════════
  7348.        .Group header
  7349.          Films in {category field}
  7350.        .List items
  7351.         {title field} Starring {Star field} Running time {length Fld}
  7352.        .end
  7353.  
  7354.        ......................procedure code.................
  7355.        declare output fields
  7356.           films.title:films.star:films.length:films.category
  7357.        end
  7358.        declare variables
  7359.           catcheck as text
  7360.        end
  7361.        '............
  7362.        bold on
  7363.        print report header
  7364.        for films with groupindex in order
  7365.           if films.category <> catcheck then
  7366.              bold on
  7367.              print group header
  7368.              bold off
  7369.           end if
  7370.           print list items
  7371.        next
  7372.  
  7373.                                  - 126 -
  7374. ................................................................................
  7375.        SPELLDAY                   FUNCTION                    SPELLDAY
  7376.  
  7377.        This function spells out the day of the number (1-7) parameter.
  7378.  
  7379.        Ex.   Spellday(dayofweek(system date))
  7380.  
  7381.  
  7382.        Acceptable parameters:
  7383.  
  7384.        Numeric value                              (1-7)
  7385.        Numeric expression evaluating to           (1-7)
  7386.        Numeric Field/variable holding value       (1-7)
  7387.        Any function returning a numeric value     (1-7)
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.                                  - 127 -
  7431. ................................................................................
  7432.        SPELLMONTH                 FUNCTION                  SPELLMONTH
  7433.  
  7434.        This function spells out the day of the number (1-12)
  7435.        parameter.
  7436.  
  7437.  
  7438.        Ex.   Spellmonth(month(system date))
  7439.  
  7440.        Ex.   Month = Spellmonth(month(invoices.date))
  7441.  
  7442.  
  7443.        Acceptable parameters:
  7444.  
  7445.        Numeric value                           (1-12)
  7446.        Numeric expression evaluating to        (1-12)
  7447.        Numeric Field/variable holding value    (1-12)
  7448.        Any function returning a numeric value  (1-12)
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.  
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484.  
  7485.  
  7486.  
  7487.                                  - 128 -
  7488. ................................................................................
  7489.        START HERE             DERIVATION PREFIX             START HERE
  7490.  
  7491.        If, in a form or procedure input screen, you want the cursor to
  7492.        start in other than the top left field then derive the field in
  7493.        which you wish the cursor to start with "Start here" .
  7494.  
  7495.        If the field in which the cursor is to start already has a
  7496.        derivation then simply prefix the derivation with "Start here".
  7497.  
  7498.        Ex.
  7499.  
  7500.        start here Lookup(customers,name)
  7501.  
  7502.  
  7503.  
  7504.        Note: You can only have one prefix on any one field derivation.
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.  
  7532.  
  7533.  
  7534.  
  7535.  
  7536.  
  7537.  
  7538.  
  7539.  
  7540.  
  7541.  
  7542.  
  7543.  
  7544.                                  - 129 -
  7545. ................................................................................
  7546.        STRINGOF                   FUNCTION                    STRINGOF
  7547.  
  7548.        This function returns a string of characters.
  7549.  
  7550.        Ex.   Stringof(12,"-")
  7551.               < Returns "------------">
  7552.  
  7553.  
  7554.        Ex.  Stringof(5,chr$(240))
  7555.              < Returns "≡≡≡≡≡">
  7556.  
  7557.  
  7558.        One of the most useful applications of the "Stringof" function
  7559.        is to pad output fields in tabular reports with "." characters.
  7560.  
  7561.        Ex.
  7562.  
  7563.        Declare output fields
  7564.           stock.name : stock.price
  7565.        end
  7566.        for stock with name in order
  7567.           stock.name = jointext(stock.name,stringof(30-lengthtext(
  7568.                        stock.name),".")
  7569.           print list items
  7570.        next
  7571.  
  7572.  
  7573.        The printed output from the above report would be in the form:-
  7574.  
  7575.              Gizmo.........................  2.50
  7576.              Sprocket......................  9.95
  7577.              Widget........................  3.10
  7578.  
  7579.  
  7580.  
  7581.        Acceptable parameters:
  7582.  
  7583.        1   Any numeric field, variable, expression or function
  7584.        2   Single quoted character - Function returning a single
  7585.            character
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.  
  7600.  
  7601.                                  - 130 -
  7602. ................................................................................
  7603.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7604.  
  7605.        If you need to list records from a form in such a way that they
  7606.        are in groups but with each group in order, there are two ways
  7607.        to accomplish this. You can include a compound index field on
  7608.        the form or you can "subindex" the group during the procedure.
  7609.        The advantage of having a compound index is that no time is
  7610.        wasted "sorting" the sub group during any procedure that uses
  7611.        it and the disadvantage is that it uses extra disk space. As a
  7612.        general rule you should use a compound index where the sub
  7613.        groups are likely to be large and "subindex" during the
  7614.        procedure only if each sub group has up to a few dozen or so
  7615.        records or if you need to order unnatural groupings.
  7616.  
  7617.        Ex.
  7618.  
  7619.        for pupils alias agegroups with age in order unique
  7620.           for pupils alias sortgroup with age = agegroups.age
  7621.              subindex name
  7622.           next
  7623.           for pupils with subindex in order
  7624.              print list items
  7625.           next
  7626.        next
  7627.  
  7628.        The grouping can be extended to more than one level. The
  7629.        following example lists records from a "Videos" form grouped
  7630.        by rental price then by category and with the sub sub group
  7631.        titles in alphabetic order.
  7632.  
  7633.        for videos alias pricegroups with price in order unique
  7634.           for videos alias catgroups with category in order unique
  7635.              for videos alias group with category = catgroups.category
  7636.                 if group.price = pricegroups.price then
  7637.                    subindex title
  7638.                 end if
  7639.              next
  7640.              for videos with subindex in order
  7641.                 print list items
  7642.              next
  7643.           next
  7644.        next
  7645.  
  7646.        As you can see from the listing the output from these examples
  7647.        has to pause between groups while the subindex is written. If
  7648.        you have a 66 Mhz PC and there are twenty records in the sub
  7649.        group you probably won't notice but if you have a 12 Mhz
  7650.        machine and there are a thousand records in the sub group you
  7651.        may as well break for lunch!  If you write a "subindexing"
  7652.        procedure and find that the "Sorting" time is unacceptable then
  7653.        add a compound index field to the form.
  7654.  
  7655.  
  7656.  
  7657.  
  7658.                                  - 131 -
  7659. ................................................................................
  7660.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7661.  
  7662.        Although using compound index fields to produce group ordering
  7663.        is normally preferable to using "Subindex", there is one
  7664.        important area where "Subindex" is more flexible. That is where
  7665.        you need to order records in unnatural groups.
  7666.  
  7667.        Consider the "Videos" form which has fields for "Title" ,
  7668.        "RentalPrice" and "Category".
  7669.  
  7670.        Natural Groupings would be:-
  7671.  
  7672.        Titles with RentalPrice = £2
  7673.        Titles with Category = "Comedy"
  7674.        Titles with RentalPrice = £2 and category = "Horror"
  7675.  
  7676.        Unnatural groupings would be :-
  7677.  
  7678.        Titles with RentalPrice = £2 or Rentalprice = £1.50
  7679.        Titles With RentalPrice = £1.50 or Category = "Western"
  7680.  
  7681.        Although you can make compound index fields to produce
  7682.        unnatural groupings they are not flexible - You need a separate
  7683.        compound index for each unnatural group.
  7684.  
  7685.        If you wished to write a procedure which allowed the user to
  7686.        enter any two video "Categories" and have all titles with
  7687.        either of those two categories listed in order then you must
  7688.        use "Subindex".
  7689.  
  7690.        Ex.
  7691.  
  7692.        for videos alias cat1 with category = input.cat1
  7693.           subindex title
  7694.        next
  7695.        for videos alias cat2 with category = input.cat2
  7696.           subindex title
  7697.        next
  7698.        for videos with subindex in order
  7699.           print list items
  7700.        next
  7701.  
  7702.        You will notice in the above example that two "For" loops add
  7703.        records to the "Subindex" before it is used. Once you start a
  7704.        subindex you can add records to it as often as you wish before
  7705.        using it. Once you use it it is erased.
  7706.  
  7707.        You can only have one "Subindex" active at any time. You can
  7708.        use any number of "Subindexes" within one procedure but each
  7709.        one must be "used" before the next is started.
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.                                  - 132 -
  7716. ................................................................................
  7717.        SYSTEM DATE              SYSTEM VALUE               SYSTEM DATE
  7718.  
  7719.        You can use your computers inbuilt date anywhere in field
  7720.        derivations or procedure code by simply quoting "system date".
  7721.  
  7722.        Ex.
  7723.  
  7724.        for diary with date = system date
  7725.           print list items
  7726.        next
  7727.  
  7728.  
  7729.  
  7730.  
  7731.  
  7732.  
  7733.  
  7734.  
  7735.  
  7736.  
  7737.  
  7738.  
  7739.  
  7740.  
  7741.  
  7742.  
  7743.  
  7744.  
  7745.  
  7746.  
  7747.  
  7748.  
  7749.  
  7750.  
  7751.  
  7752.  
  7753.  
  7754.  
  7755.  
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.  
  7762.  
  7763.  
  7764.  
  7765.  
  7766.  
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.                                  - 133 -
  7773. ................................................................................
  7774.        SYSTEM TIME              SYSTEM VALUE               SYSTEM TIME
  7775.  
  7776.        You can use your computers inbuilt time anywhere in field
  7777.        derivations or procedure code by simply quoting "system time".
  7778.  
  7779.        Ex.
  7780.  
  7781.        for stockitems with stockno = input.stockno
  7782.           lastcheckeddate = system date
  7783.           lastcheckedtime = system time
  7784.           update record
  7785.        next
  7786.  
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.  
  7796.  
  7797.  
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.  
  7820.  
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.                                  - 134 -
  7830. ................................................................................
  7831.        TABULATION                  METHOD                   TABULATION
  7832.  
  7833.        To create a printout in which fields are enclosed within a
  7834.        lined table use the linedrawing facility in the format editor
  7835.        to create a page header and page footer containing the top and
  7836.        bottom of the table and insert only the vertical lines between
  7837.        the fields in the list items section.
  7838.  
  7839.        Ex.
  7840.  
  7841.        Declare output fields
  7842.           stock.name : stock.price
  7843.        end
  7844.        print page header
  7845.        for stock with name in order
  7846.           if bottom margin < 0.7 then
  7847.              print page footer
  7848.              page feed
  7849.              print page header
  7850.           end if
  7851.           print list items
  7852.        next
  7853.        print page footer
  7854.        Page feed
  7855.  
  7856.        ........................format.........................
  7857.  
  7858.        .page header
  7859.              ╔════════════════════╤═══════════════╗
  7860.              ║ Name               │  Price        ║
  7861.              ╠════════════════════╪═══════════════╣
  7862.        .list items
  7863.              ║ {Name Field     }  │ {Price Fld. } ║
  7864.        .page footer
  7865.              ╚════════════════════╧═══════════════╝
  7866.        .end
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.                                  - 135 -
  7887. ................................................................................
  7888.        TEXT                      FIELD TYPE                       TEXT
  7889.  
  7890.        The text field type can be up to 80 characters long.
  7891.  
  7892.        Cut copy and paste operations are available between all text,
  7893.        and textblock fields :
  7894.  
  7895.        Use Shift plus the arrow keys to mark the text you wish to cut
  7896.        or copy. When you release the keys the cut or copy choice will
  7897.        appear.
  7898.  
  7899.        To paste cut text position the cursor where you want it
  7900.        inserted and press Shift plus Ins.
  7901.  
  7902.        Spell Checking is also available in text fields -
  7903.           Press Ctrl + S
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.  
  7937.  
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.                                  - 136 -
  7944. ................................................................................
  7945.        TEXT BLOCK                FIELD TYPE                 TEXT BLOCK
  7946.  
  7947.        When you Define a field with the field type "Text Block" then
  7948.        instead of entering a field length you shade out the area which
  7949.        you wish the field to cover using the arrow keys.
  7950.  
  7951.        Textblock fields offer many of the facilities of a
  7952.        wordprocessor including cut and paste, wordwrap and spell
  7953.        checking.
  7954.  
  7955.        Useful widths for A4 and Letter size paper are 63 characters if
  7956.        you intend to print at 10 characters per inch and 75 characters
  7957.        if you intend to print at 12 characters per inch. This document
  7958.        for instance was created in 63 character wide text blocks.
  7959.  
  7960.        The maximum width of a text block field on screen is 80
  7961.        characters. You can however redefine it up to 230 characters
  7962.        wide in procedure printouts and Easy Base will reformat your
  7963.        paragraphs to the new width.
  7964.  
  7965.        A text block field is not a "memo" field. It can be indexed and
  7966.        derived.
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.  
  8000.                                  - 137 -
  8001. ................................................................................
  8002.        TIME                      FIELD TYPE                       TIME
  8003.  
  8004.        The Easy Base "time" field has the eight character format:-
  8005.  
  8006.        11:20:20    (Hours:Minutes:Seconds)
  8007.  
  8008.        You can record time data in any format you wish by using a
  8009.        "Formatted Text" field but you must use a "Time" field if you
  8010.        wish to perform addition and subtraction operations on time
  8011.        values.  (in seconds)
  8012.  
  8013.        Time fields are automatically checked for validity.
  8014.  
  8015.  
  8016.        See Also:-  Maketime
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.  
  8028.  
  8029.  
  8030.  
  8031.  
  8032.  
  8033.  
  8034.  
  8035.  
  8036.  
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.                                  - 138 -
  8058. ................................................................................
  8059.        TIMEAMPM                   FUNCTION                    TIMEAMPM
  8060.  
  8061.        This function returns the hour ( 0 - 12) plus am. or pm. from
  8062.        the time field parameter.
  8063.  
  8064.        Ex. Timeampm(system time)
  8065.  
  8066.        Ex.
  8067.        -------------------------format----------------------------
  8068.        .Report header
  8069.                       Appointments for {Apps.Date Field}
  8070.        .List items
  8071.                  {Apps.Name Field      }   at  {Time Field}
  8072.        .End
  8073.        -------------------------code----------------------------
  8074.        declare output fields
  8075.           Apps.name
  8076.           Apps.date
  8077.           Time
  8078.        end
  8079.        print report header
  8080.        for apps with date = system date
  8081.           time = timeampm(apps.time)
  8082.           print list items
  8083.        next
  8084.  
  8085.  
  8086.        Acceptable parameters:
  8087.  
  8088.        System time
  8089.        Time field
  8090.        Maketime function
  8091.        Time expression
  8092.  
  8093.  
  8094.  
  8095.  
  8096.  
  8097.  
  8098.  
  8099.  
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.                                  - 139 -
  8115. ................................................................................
  8116.        TOTAL COPIES             SYSTEM VALUE              TOTAL COPIES
  8117.  
  8118.        Whenever a procedure enters a "FOR" loop qualified by "With
  8119.        fieldname = " the total number of records which match the
  8120.        qualification value is available in the system value "Total
  8121.        Copies"
  8122.  
  8123.        Total Copies is extracted directly from the index file and
  8124.        relieves you of a time consuming loop all the way through a
  8125.        form updating a counter.
  8126.  
  8127.        In other words:-
  8128.  
  8129.        for books with category = "fiction"
  8130.           count = count + 1
  8131.        next
  8132.  
  8133.        can be replaced with:-
  8134.  
  8135.        for books with category = "fiction"
  8136.           count = total copies
  8137.           exit for
  8138.        next
  8139.  
  8140.        Unlike "Total Records" the "Total Copies" value never includes
  8141.        records marked for deletion.
  8142.  
  8143.        Easy Base does not track separate values for "Total Records" or
  8144.        "Total Copies" when there are nested "For" loops. The values
  8145.        are set for the outer loop on the first iteration and reset for
  8146.        the inner loop on its first iteration. If you need a value for
  8147.        "Total Records" or for "Total Copies" after your procedure has
  8148.        entered another loop then you must transfer the value to a
  8149.        variable while it is available. (See the example for "Display
  8150.        Status")
  8151.  
  8152.        Easy Base does not update "Total Records" or "Total Copies"
  8153.        when records are added or deleted during a procedure.
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.                                  - 140 -
  8172. ................................................................................
  8173.        TOTAL RECORDS            SYSTEM VALUE             TOTAL RECORDS
  8174.  
  8175.        Whenever a procedure enters a "FOR" loop the total number of
  8176.        records in the form is available in the system value "Total
  8177.        records"
  8178.  
  8179.        Ex.
  8180.        The following code fragment updates a "Customer summary" form
  8181.        with the total number of customers in the "Customers" form.
  8182.  
  8183.        declare variables
  8184.          tot as number
  8185.        end
  8186.        for customers with acno = 1
  8187.           tot = total records
  8188.           exit for
  8189.        next
  8190.        for customersummary
  8191.           customersummary.totalcustomers = tot
  8192.           update record
  8193.        next
  8194.  
  8195.        Caution.
  8196.  
  8197.        Provided that the "For" loop is qualified by a "with" statement
  8198.        then the "Total Records" value is extracted directly from the
  8199.        open index file and is the total number of "Live Records".
  8200.  
  8201.        If you access the "Total records" value in an unqualified "For"
  8202.        loop then there is no index file open and the "Total Records"
  8203.        value is derived by dividing the forms file length by the
  8204.        record length. It therefore represents the total number of
  8205.        records in the form "Live" and "Deleted".
  8206.  
  8207.        Ex.
  8208.  
  8209.        If a form "books" has 2000 records and 10 are marked for
  8210.        deletion at the next re-pack then "count" returns 1990 in:-
  8211.  
  8212.        for books with catalogueno = 1
  8213.          count = total records
  8214.        next
  8215.  
  8216.        and 2000 in :-
  8217.  
  8218.        for books
  8219.           count = total records
  8220.           exit for
  8221.        next
  8222.  
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.                                  - 141 -
  8229. ................................................................................
  8230.        TOTALS & SUB TOTALS         METHOD          TOTALS & SUB TOTALS
  8231.  
  8232.        To produce totals and sub totals in printouts use ad hoc fields
  8233.        to hold the values and increment them during each iteration of
  8234.        the output loops. The following code lists all entries in a
  8235.        clients time sheet form with the cost of work in hand totalled
  8236.        and sub totalled for each client.
  8237.  
  8238.        Declare output fields
  8239.          Clients.Name:Timesheet.Hrs:Timesheet.Mins:Timesheet.Amount
  8240.          Timesheet.date : Subtotal : Grandtotal
  8241.        end
  8242.        Print Report Header
  8243.        for Clients with name in order
  8244.           Print Group Header
  8245.           Subtotal = 0
  8246.           For Timesheet with Acno = Clients.Acno
  8247.              Subtotal = Subtotal + timesheet.amount
  8248.              Grandtotal = Grandtotal + Timesheet.amount
  8249.              Print List Items
  8250.           next
  8251.           Print Group Footer
  8252.        next
  8253.        Print report footer
  8254.  
  8255.        .......................Output Format.........................
  8256.        .Report Header
  8257.           ═════════════════════════════════════════════════════════
  8258.                     Work in Hand Totalled by Client
  8259.           ═════════════════════════════════════════════════════════
  8260.        .Group Header
  8261.  
  8262.           ██████████████████
  8263.        .List Items
  8264.              ████████      ██Hrs ██Mins                     ██████
  8265.        .Group Footer
  8266.                                                         ──────────
  8267.            Total for ██████████████████                 ██████████
  8268.                                                         ══════════
  8269.        .Report Footer
  8270.           ═════════════════════════════════════════════════════════
  8271.           Total Work In Hand                            ██████████
  8272.           ═════════════════════════════════════════════════════════
  8273.        .end
  8274.  
  8275.        The field in the Group Header is Clients.name
  8276.        The fields in List Items are Timesheet.date, Timesheet.Hrs,
  8277.        Timesheet.Mins and Timesheet.amount.
  8278.        The fields in Group Footer are Clients.name and Subtotal.
  8279.        The field in Report Footer is Grandtotal.
  8280.  
  8281.  
  8282.  
  8283.  
  8284.  
  8285.                                  - 142 -
  8286. ................................................................................
  8287.        UPDATE RECORD          PROCEDURE COMMAND          UPDATE RECORD
  8288.  
  8289.        The "Update record" command is used to alter the contents of
  8290.        one or many records in a form.
  8291.  
  8292.        Ex.
  8293.  
  8294.        for stock with item = input.item
  8295.           stock.price = input.price
  8296.           stock.pricechangedate = system date
  8297.           update record
  8298.        next
  8299.  
  8300.        This example changes the price of a single "Stock" item.
  8301.  
  8302.  
  8303.        for employees with taxcode = input.oldtaxcode
  8304.           employees.taxcode = input.newtaxcode
  8305.           update record
  8306.        next
  8307.  
  8308.        This example changes the taxcode field of all the employees
  8309.        whose present taxcode is the same as the input screen
  8310.        "oldtaxcode" to the input screen "newtaxcode".
  8311.  
  8312.  
  8313.        for employees
  8314.           employees.taxcode = employees.taxcode + 60
  8315.           update record
  8316.        next
  8317.  
  8318.        This example increases the taxcode of all employees by sixty.
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.                                  - 143 -
  8343. ................................................................................
  8344.        UPPER                      FUNCTION                       UPPER
  8345.  
  8346.        Returns the Uppercase of a text field or variable.
  8347.  
  8348.        Ex.  Upper(postcode)
  8349.             < shows the postcode field in uppercase>
  8350.  
  8351.        Ex.
  8352.        '.......................
  8353.        declare output fields
  8354.           labelname
  8355.           labeladdress
  8356.           labelcode
  8357.        end
  8358.        for customers with maillist = "yes"
  8359.           Labelname = Upper(customers.name)
  8360.           Labeladdress = Upper(customers.address)
  8361.           Labelcode = customers.postcode
  8362.           print labels
  8363.        next
  8364.  
  8365.        Acceptable parameters:
  8366.  
  8367.        Quoted text
  8368.        Text field/variable
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.                                  - 144 -
  8400. ................................................................................
  8401.        V.A.T. FUNCTIONS           FUNCTION            V.A.T. FUNCTIONS
  8402.  
  8403.        Easy Base has a set of five VAT rates which can be altered from
  8404.        the utilities menu. There are four VAT functions:-
  8405.           VATin
  8406.           VATon
  8407.           PlusVAT
  8408.           MinusVAT
  8409.  
  8410.        Ex.   VATin(retailprice,2)
  8411.               < Returns the VAT content of "retailprice" at VAT rate 2
  8412.  
  8413.        Ex.   VATon(netprice,4)
  8414.              < Returns the VAT to be added to "netprice" at VAT rate 4
  8415.  
  8416.        Ex.   PlusVAT(netprice,3)
  8417.              < Returns the VAT inclusive price at VAT rate 3>
  8418.  
  8419.        Ex.   MinusVAT(retailprice,2)
  8420.              < Returns the net price of "retailprice" before VAT at
  8421.                VAT rate 2>
  8422.  
  8423.         (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  8424.  
  8425.        If the second parameter (rate) is omitted from any of the VAT
  8426.        functions then Rate 1 is assumed.
  8427.  
  8428.        Ex.   Gross = PlusVAT(input.net)
  8429.              < The variable "Gross" = the VAT inclusive of the input
  8430.               screen field "net" calculated at rate 1.>
  8431.  
  8432.        Although the VAT functions are primarily included for business
  8433.        applications, they can be used for any purpose where a
  8434.        percentage needs to be changed globally throughout an
  8435.        application without the need to alter each procedure or field
  8436.        derivation in which it is used.
  8437.  
  8438.        Acceptable parameters:
  8439.  
  8440.        1   Any numeric value, field, variable, expression or function
  8441.        2   As Parameter 1 but evaluating between 1 an 5
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.  
  8456.                                  - 145 -
  8457. ................................................................................
  8458.        YEAR                       FUNCTION                        YEAR
  8459.  
  8460.        This function returns the year number from a date parameter.
  8461.  
  8462.        Ex.    Year(system date)
  8463.  
  8464.        Ex.
  8465.  
  8466.        Carage = jointext((year(system date)-year(registered))," Years
  8467.        old")
  8468.  
  8469.  
  8470.        Acceptable parameters:
  8471.  
  8472.        System date
  8473.        Date field
  8474.        Makedate function
  8475.        Date expression
  8476.  
  8477.  
  8478.  
  8479.  
  8480.  
  8481.  
  8482.  
  8483.  
  8484.  
  8485.  
  8486.  
  8487.  
  8488.  
  8489.  
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.  
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.                                  - 146 -
  8514. ................................................................................
  8515.        ZEROPAD                    FUNCTION                     ZEROPAD
  8516.  
  8517.        The Zeropad function pads an integer or fixed point field to a
  8518.        given number of places left and right of the decimal point.
  8519.  
  8520.        Ex.  Zeropad(price,3,2)
  8521.             <Returns "001.50" if price = 1.5>
  8522.  
  8523.        Ex.  Zeropad(acno,6,0)
  8524.             <Returns "004532" if acno = 4,532>
  8525.  
  8526.        The Zeropad function can be used as in the second example to
  8527.        return a fixed length numeric string from an integer field.
  8528.        It's main use, however, is in the creation of fields for
  8529.        compound indices where one of the fields to be compounded is a
  8530.        number.
  8531.  
  8532.        For example: A school has all pupils names and ages recorded on
  8533.        a form in fields "name" and "age". To create an index which
  8534.        will list pupils names alphabetically but grouped by age a
  8535.        compound field which is invisible and does not allow user entry
  8536.        is created as a text field derived with:-
  8537.        Jointext(zeropad(age,2,0),name)
  8538.  
  8539.        Because the compound field is text the index file will be
  8540.        sorted alphabetically. If you sort the numbers 8,9 and 12
  8541.        alphabetically you get 12,8,9 because the one in 12 comes
  8542.        before 8. If however you sort the numbers 08,09 and 12
  8543.        alphabetically you get the correct numeric order.
  8544.  
  8545.        By using the zeropad function in the above example and indexing
  8546.        the compound field,let's call it "unifield" you could then
  8547.        print out the pupils in age groups with the names in each group
  8548.        arranged alphabetically.
  8549.        .........................format.................
  8550.        .group header
  8551.         Pupils aged {pupils.age field}
  8552.        .list items
  8553.                {pupils.name field}
  8554.        .end
  8555.        .........................procedure code.........
  8556.        declare output fields
  8557.           pupils.name:pupils.age
  8558.        end
  8559.        declare variables
  8560.           agecheck as number
  8561.        end
  8562.        agecheck = 0
  8563.        for pupils with unifield in order
  8564.           if pupils.age <> agecheck then print group header
  8565.           agecheck = pupils.age
  8566.           print list items
  8567.        next
  8568.  
  8569.  
  8570.                                  - 147 -
  8571. ................................................................................
  8572.